@depict-ai/ui 2.0.25 → 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 +489 -114
- package/ES10/index.d.ts +75 -45
- package/ES10/index.js +490 -115
- package/latest/index.cjs +458 -106
- package/latest/index.d.ts +75 -45
- package/latest/index.js +459 -107
- package/locales/require.js +1152 -0
- package/package.json +4 -4
- package/server/ES10/index.cjs +460 -114
- package/server/ES10/index.d.ts +75 -45
- package/server/ES10/index.js +461 -115
- package/server/latest/index.cjs +429 -106
- package/server/latest/index.d.ts +75 -45
- package/server/latest/index.js +430 -107
package/latest/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { add_to_version_info as $9HbP8$add_to_version_info, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, dlog as $9HbP8$dlog, queueMacroTask as $9HbP8$queueMacroTask, catchify as $9HbP8$catchify, is_safari as $9HbP8$is_safari, observer as $9HbP8$observer, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, slider_fractional_factory as $9HbP8$slider_fractional_factory, camelCasifyObject as $9HbP8$camelCasifyObject, make_random_classname as $9HbP8$make_random_classname, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, report as $9HbP8$report, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, edit_current_page_meta_tags as $9HbP8$edit_current_page_meta_tags, javascript_media_query as $9HbP8$javascript_media_query, use_href_accessor as $9HbP8$use_href_accessor, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, ListenableSet as $9HbP8$ListenableSet, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
|
|
2
2
|
import { createComponent as $9HbP8$createComponent, template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, effect as $9HbP8$effect, style as $9HbP8$style, spread as $9HbP8$spread, mergeProps as $9HbP8$mergeProps, runHydrationEvents as $9HbP8$runHydrationEvents, insert as $9HbP8$insert, setAttribute as $9HbP8$setAttribute, isServer as $9HbP8$isServer, addEventListener as $9HbP8$addEventListener, className as $9HbP8$className, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, classList as $9HbP8$classList, getNextMarker as $9HbP8$getNextMarker, Dynamic as $9HbP8$Dynamic, use as $9HbP8$use } from "solid-js/web";
|
|
3
|
-
import { createSignal as $9HbP8$createSignal, getOwner as $9HbP8$getOwner, createEffect as $9HbP8$createEffect, runWithOwner as $9HbP8$runWithOwner, onCleanup as $9HbP8$onCleanup, createMemo as $9HbP8$createMemo, createContext as $9HbP8$createContext, useContext as $9HbP8$useContext, createResource as $9HbP8$createResource, Suspense as $9HbP8$Suspense, Show as $9HbP8$Show, createRenderEffect as $9HbP8$createRenderEffect, createRoot as $9HbP8$createRoot, For as $9HbP8$For, createUniqueId as $9HbP8$createUniqueId,
|
|
3
|
+
import { createSignal as $9HbP8$createSignal, getOwner as $9HbP8$getOwner, createEffect as $9HbP8$createEffect, runWithOwner as $9HbP8$runWithOwner, onCleanup as $9HbP8$onCleanup, createMemo as $9HbP8$createMemo, createContext as $9HbP8$createContext, useContext as $9HbP8$useContext, createResource as $9HbP8$createResource, Suspense as $9HbP8$Suspense, Show as $9HbP8$Show, untrack as $9HbP8$untrack, createRenderEffect as $9HbP8$createRenderEffect, Index as $9HbP8$Index, createRoot as $9HbP8$createRoot, For as $9HbP8$For, createUniqueId as $9HbP8$createUniqueId, createComputed as $9HbP8$createComputed, ErrorBoundary as $9HbP8$ErrorBoundary, on as $9HbP8$on, batch as $9HbP8$batch, createReaction as $9HbP8$createReaction, mapArray as $9HbP8$mapArray, mergeProps as $9HbP8$mergeProps1 } from "solid-js";
|
|
4
|
+
import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from "solid-js/store";
|
|
4
5
|
|
|
5
6
|
/*! Depict.ai search and product listing SDK */
|
|
6
7
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
7
8
|
register_es_version("ui", "latest");
|
|
8
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "2.0
|
|
9
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "2.1.0";
|
|
9
10
|
const $4147651646da990a$var$fallback_operator = "in";
|
|
10
11
|
const $4147651646da990a$var$fallback_token = "";
|
|
11
12
|
const $4147651646da990a$var$legacy_filter_prefix = "filter_";
|
|
@@ -420,7 +421,7 @@ const $b5cccc8ee7d24677$export$6daf8749b65a1b77 = cols_at_size => {
|
|
|
420
421
|
return $b5cccc8ee7d24677$var$transform_elements(sorted_cols_at_size);
|
|
421
422
|
};
|
|
422
423
|
function $a458486f22b22f63$export$a2cc176055f8f08() {
|
|
423
|
-
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.";
|
|
424
|
+
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.";
|
|
424
425
|
return (0, $9HbP8$isServer) ? {
|
|
425
426
|
t: `<!-- ${text} -->`
|
|
426
427
|
} : document.createComment(text);
|
|
@@ -441,12 +442,13 @@ let $6e41f1fde994db72$var$cached_placeholder_element;
|
|
|
441
442
|
let $6e41f1fde994db72$var$rendering_cached_placeholder_element;
|
|
442
443
|
function $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
443
444
|
product_card_template_: product_card_template_,
|
|
444
|
-
num_placeholders_: num_placeholders_
|
|
445
|
+
num_placeholders_: num_placeholders_,
|
|
446
|
+
content_blocks_: content_blocks_
|
|
445
447
|
}) {
|
|
446
|
-
const [
|
|
447
|
-
let existing_num = 0;
|
|
448
|
+
const [num_to_actually_show, set_num_to_actually_show] = $9HbP8$createSignal($9HbP8$untrack(num_placeholders_));
|
|
448
449
|
if (0, $9HbP8$isServer)
|
|
449
450
|
// want to render simple placeholders on server, effects don't run there
|
|
451
|
+
// FIXME when adding proper SSR: also SSR content blocks
|
|
450
452
|
return $9HbP8$createMemo(() => Array.from({
|
|
451
453
|
length: num_placeholders_()
|
|
452
454
|
}).map(() => {
|
|
@@ -455,19 +457,30 @@ function $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
|
455
457
|
if (typeof template_result?.then !== "function") return template_result;
|
|
456
458
|
}));
|
|
457
459
|
$9HbP8$createRenderEffect(() => {
|
|
460
|
+
const existing_num = num_to_actually_show();
|
|
458
461
|
const to_add = num_placeholders_() - existing_num;
|
|
459
462
|
if (to_add <= 0) return;
|
|
460
463
|
// 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.
|
|
461
464
|
// 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.
|
|
462
465
|
// 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.
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
466
|
+
// 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
|
|
467
|
+
// Functionality should be the same
|
|
468
|
+
set_num_to_actually_show(existing_num + to_add);
|
|
469
|
+
});
|
|
470
|
+
return $9HbP8$createComponent((0, $9HbP8$Index), {
|
|
471
|
+
get each() {
|
|
472
|
+
return Array.from({
|
|
473
|
+
length: num_to_actually_show()
|
|
474
|
+
});
|
|
475
|
+
},
|
|
476
|
+
children: (_item, index) => {
|
|
477
|
+
const possible_content_block = $9HbP8$createMemo(() => content_blocks_?.()?.()?.[index]);
|
|
478
|
+
// Show content block before product card, so it's *at* that index
|
|
479
|
+
return [possible_content_block, $6e41f1fde994db72$var$Placeholder({
|
|
480
|
+
product_card_template_: product_card_template_
|
|
481
|
+
})]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
482
|
+
}
|
|
469
483
|
});
|
|
470
|
-
return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
471
484
|
}
|
|
472
485
|
/**
|
|
473
486
|
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
@@ -552,7 +565,8 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
|
552
565
|
merchant_: merchant_,
|
|
553
566
|
market_: market_,
|
|
554
567
|
product_card_template_: product_card_template_,
|
|
555
|
-
do_per_elements_: do_per_elements_
|
|
568
|
+
do_per_elements_: do_per_elements_,
|
|
569
|
+
content_blocks_: content_blocks_
|
|
556
570
|
}) {
|
|
557
571
|
return $9HbP8$createComponent((0, $9HbP8$For), {
|
|
558
572
|
get each() {
|
|
@@ -560,6 +574,7 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
|
560
574
|
},
|
|
561
575
|
children: (product_id, index) => {
|
|
562
576
|
const owner = $9HbP8$getOwner();
|
|
577
|
+
const possible_content_block = $9HbP8$createMemo(() => content_blocks_?.()?.()?.[index()]);
|
|
563
578
|
const display_accessor = $9HbP8$createMemo(prev => {
|
|
564
579
|
const new_display = displays_by_key_().get(product_id);
|
|
565
580
|
if (prev && $29ec7cddbe1d3484$var$deep_equal(prev, new_display))
|
|
@@ -612,7 +627,9 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
|
612
627
|
}
|
|
613
628
|
do_per_elements_?.(elements, index);
|
|
614
629
|
});
|
|
615
|
-
return
|
|
630
|
+
return [
|
|
631
|
+
// Show content block before product card, so it's *at* that index
|
|
632
|
+
possible_content_block, product_card_resource]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
616
633
|
}
|
|
617
634
|
});
|
|
618
635
|
}
|
|
@@ -3844,11 +3861,13 @@ function $90980bd87c9960f9$var$proxy_push_state(function_name, thing) {
|
|
|
3844
3861
|
thing[function_name] = new Proxy(thing[function_name], {
|
|
3845
3862
|
apply(target, this_arg, arg_list) {
|
|
3846
3863
|
try {
|
|
3847
|
-
|
|
3864
|
+
const old_state = history.state;
|
|
3865
|
+
if (typeof old_state == "object" && old_state !== null) {
|
|
3866
|
+
// This effectively disallows the user from passing in a string, number, null or undefined
|
|
3867
|
+
const intended_new_value_as_obj = typeof arg_list[0] === "object" ? arg_list[0] ?? {} : {};
|
|
3848
3868
|
const cloned_object = {
|
|
3849
|
-
...
|
|
3869
|
+
...intended_new_value_as_obj
|
|
3850
3870
|
};
|
|
3851
|
-
const old_state = history.state;
|
|
3852
3871
|
for (const key in old_state) {
|
|
3853
3872
|
if (!$90980bd87c9960f9$var$starts_with_any_prefix(key)) continue;
|
|
3854
3873
|
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
@@ -4550,7 +4569,9 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
4550
4569
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
4551
4570
|
query_base_: query_base_,
|
|
4552
4571
|
depict_api_: depict_api_,
|
|
4553
|
-
is_loading_: is_loading_
|
|
4572
|
+
is_loading_: is_loading_,
|
|
4573
|
+
content_blocks_: content_blocks_,
|
|
4574
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4554
4575
|
}) {
|
|
4555
4576
|
// 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
|
|
4556
4577
|
const target_to_index_map = new Map();
|
|
@@ -4594,11 +4615,13 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
4594
4615
|
query_base_: query_base_,
|
|
4595
4616
|
depict_api_: depict_api_
|
|
4596
4617
|
});
|
|
4618
|
+
$9HbP8$createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
4597
4619
|
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
4598
4620
|
displays_by_key_: displays_by_key_,
|
|
4599
4621
|
merchant_: merchant_,
|
|
4600
4622
|
market_: market_,
|
|
4601
4623
|
product_card_template_: product_card_template_,
|
|
4624
|
+
content_blocks_: content_blocks_,
|
|
4602
4625
|
do_per_elements_: (elements, index_accessor) =>
|
|
4603
4626
|
// Adds/removes elements from the "results in viewport" intersection observer above
|
|
4604
4627
|
$9HbP8$createEffect(() => {
|
|
@@ -4620,6 +4643,343 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
4620
4643
|
})
|
|
4621
4644
|
});
|
|
4622
4645
|
}
|
|
4646
|
+
const $6dee9211e57ac31a$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div></div>`, 2),
|
|
4647
|
+
$6dee9211e57ac31a$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<style type="text/css"></style>`, 2);
|
|
4648
|
+
const $6dee9211e57ac31a$export$c500183c31c2b22e = "--spans-columns";
|
|
4649
|
+
function $6dee9211e57ac31a$export$ab6b147eec64fea5(props) {
|
|
4650
|
+
const container_class = "x" + $9HbP8$createUniqueId();
|
|
4651
|
+
const container_element_ = (() => {
|
|
4652
|
+
const _el$ = $9HbP8$getNextElement($6dee9211e57ac31a$var$_tmpl$);
|
|
4653
|
+
$9HbP8$spread(_el$, $9HbP8$mergeProps(() => props.element_attributes, {
|
|
4654
|
+
"classList": {
|
|
4655
|
+
[container_class]: true
|
|
4656
|
+
}
|
|
4657
|
+
}), false, true);
|
|
4658
|
+
$9HbP8$insert(_el$, () => props.children);
|
|
4659
|
+
$9HbP8$runHydrationEvents();
|
|
4660
|
+
return _el$;
|
|
4661
|
+
})(); // Don't want this in the error boundary below, it should only be for the actual layouting
|
|
4662
|
+
return $9HbP8$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
4663
|
+
message_: "Failed calculating css grid layout",
|
|
4664
|
+
severity_: "error",
|
|
4665
|
+
get children() {
|
|
4666
|
+
return $6dee9211e57ac31a$export$e2f22da34aaf310a(props, container_element_, false, container_class);
|
|
4667
|
+
}
|
|
4668
|
+
});
|
|
4669
|
+
}
|
|
4670
|
+
function $6dee9211e57ac31a$export$e2f22da34aaf310a(props, container_element, insert_after_container = false, container_class) {
|
|
4671
|
+
if (!container_class) {
|
|
4672
|
+
// only try to add if it wasn't provided, so that we have a code path without classList when doing SSR
|
|
4673
|
+
container_class = $9HbP8$make_random_classname();
|
|
4674
|
+
container_element.classList.add(container_class);
|
|
4675
|
+
}
|
|
4676
|
+
const container_selector = `.depict .${container_class}`; // class so ppl can have id if needed
|
|
4677
|
+
const col_styling = $9HbP8$createMemo(() => $6dee9211e57ac31a$var$generate_media_queried_declarations({
|
|
4678
|
+
container_selector_: container_selector,
|
|
4679
|
+
default_grid_spacing_text: props.grid_spacing,
|
|
4680
|
+
cols_at_size_: props.cols_at_size,
|
|
4681
|
+
override_vertical_spacing_: props.override_vertical_spacing,
|
|
4682
|
+
top_row_shortened_by_: props.top_row_shortened_by_()
|
|
4683
|
+
}));
|
|
4684
|
+
const base_styling = $9HbP8$createMemo(() => {
|
|
4685
|
+
return `${container_selector}{display:grid;}`;
|
|
4686
|
+
});
|
|
4687
|
+
const get_styling = $9HbP8$createMemo(() => base_styling() + col_styling());
|
|
4688
|
+
const style_element = (() => {
|
|
4689
|
+
const _el$2 = $9HbP8$getNextElement($6dee9211e57ac31a$var$_tmpl$2);
|
|
4690
|
+
$9HbP8$insert(_el$2, get_styling);
|
|
4691
|
+
return _el$2;
|
|
4692
|
+
})(); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
|
|
4693
|
+
if (insert_after_container) container_element.after(style_element);
|
|
4694
|
+
return [container_element, style_element];
|
|
4695
|
+
}
|
|
4696
|
+
function $6dee9211e57ac31a$var$generate_media_queried_declarations({
|
|
4697
|
+
container_selector_: container_selector_,
|
|
4698
|
+
default_grid_spacing_text: default_grid_spacing_text,
|
|
4699
|
+
cols_at_size_: cols_at_size_,
|
|
4700
|
+
override_vertical_spacing_: override_vertical_spacing_,
|
|
4701
|
+
top_row_shortened_by_: top_row_shortened_by_
|
|
4702
|
+
}) {
|
|
4703
|
+
return cols_at_size_.map(options => {
|
|
4704
|
+
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
4705
|
+
const spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
4706
|
+
// See comment in else block below
|
|
4707
|
+
const can_use_gap = $6dee9211e57ac31a$var$can_use_gap_for_unit(spacing_to_use) && (!override_vertical_spacing_ || $6dee9211e57ac31a$var$can_use_gap_for_unit(override_vertical_spacing_));
|
|
4708
|
+
let spacing_styling;
|
|
4709
|
+
let additional_styling = ""; // outside the media query
|
|
4710
|
+
if (can_use_gap) spacing_styling = `gap:${spacing_to_use};${override_vertical_spacing_ ? `row-gap:${override_vertical_spacing_};` : ``}`;else {
|
|
4711
|
+
// 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)
|
|
4712
|
+
// 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.
|
|
4713
|
+
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
4714
|
+
// 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.
|
|
4715
|
+
const width_multiplier = `var(${$6dee9211e57ac31a$export$c500183c31c2b22e}, 1)`; // How many cards wide the current item is (needed because content blocks)
|
|
4716
|
+
const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$6dee9211e57ac31a$var$strip_percent_unit(spacing_to_use)} / 2)) / ${n_cols}))`; // Width of one item in percent of the whole
|
|
4717
|
+
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
4718
|
+
const this_item_width_meat = `calc(${one_item_width_exclusing_gaps} * ${width_multiplier})`; // Width of just the card
|
|
4719
|
+
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$6dee9211e57ac31a$var$strip_percent_unit(spacing_to_use)})`; // Width of the gaps
|
|
4720
|
+
const this_item_width = `calc(${this_item_width_meat} + ${this_item_width_gaps})`; // Width of this item including gaps
|
|
4721
|
+
// 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
|
|
4722
|
+
const convert_top_spacing_to_item_width_percentage = spacing => `calc(calc(100 / ${this_item_width}) * ${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)
|
|
4723
|
+
spacing_styling = `column-gap:${spacing_to_use};`; // Still use gaps in the horizontal direction because that works flawlessly
|
|
4724
|
+
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
4725
|
+
additional_styling = $9HbP8$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_);
|
|
4726
|
+
}
|
|
4727
|
+
const media_query_body = `${container_selector_}{${spacing_styling}grid-template-columns:repeat(${n_cols},minmax(0,1fr));}`;
|
|
4728
|
+
return `${$9HbP8$layout_media_query_header(min, max)}{${media_query_body}}${additional_styling}`;
|
|
4729
|
+
}).join("");
|
|
4730
|
+
}
|
|
4731
|
+
function $6dee9211e57ac31a$var$can_use_gap_for_unit(spacing) {
|
|
4732
|
+
const trimmed_spacing = spacing.trim();
|
|
4733
|
+
return !trimmed_spacing.includes("%");
|
|
4734
|
+
}
|
|
4735
|
+
function $6dee9211e57ac31a$var$strip_percent_unit(css_value) {
|
|
4736
|
+
return css_value.replaceAll("%", "");
|
|
4737
|
+
}
|
|
4738
|
+
function $15aa76e6da02e5c2$export$cb5808ba002cdeed({
|
|
4739
|
+
layout_options_: layout_options_,
|
|
4740
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
4741
|
+
}) {
|
|
4742
|
+
return $9HbP8$createMemo(() => {
|
|
4743
|
+
const layout_options = layout_options_();
|
|
4744
|
+
// Add grid styling that changes when filters get opened/closed
|
|
4745
|
+
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
4746
|
+
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
4747
|
+
const [num_cols_default,,,, override_cols] = row;
|
|
4748
|
+
const cloned_row = [...row];
|
|
4749
|
+
// @ts-ignore
|
|
4750
|
+
cloned_row[0] = num_cols_default - 1;
|
|
4751
|
+
if (override_cols)
|
|
4752
|
+
// @ts-ignore
|
|
4753
|
+
cloned_row[4] = {
|
|
4754
|
+
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(([row, column]) => [row, column - 1]))
|
|
4755
|
+
};
|
|
4756
|
+
return cloned_row;
|
|
4757
|
+
}) : when_filters_closed_cols;
|
|
4758
|
+
});
|
|
4759
|
+
}
|
|
4760
|
+
function $bed740eef1769419$export$a79e666719b3647c(cols_at_size_) {
|
|
4761
|
+
const size_active = $9HbP8$createMemo(() => cols_at_size_().map(([n_cols, min_width, max_width]) => {
|
|
4762
|
+
const media_query = $9HbP8$layout_media_query_header(min_width, max_width).replaceAll("@media", "");
|
|
4763
|
+
const matches = $dc9262ef6f786812$export$d9f36cf74e24d595(media_query);
|
|
4764
|
+
return [matches, n_cols];
|
|
4765
|
+
}));
|
|
4766
|
+
const n_cols_currently_showing = $9HbP8$createMemo(() => {
|
|
4767
|
+
try {
|
|
4768
|
+
const [, n_cols_currently_showing] = size_active().find(([media_query]) => media_query());
|
|
4769
|
+
return n_cols_currently_showing;
|
|
4770
|
+
} catch (e) {
|
|
4771
|
+
$9HbP8$dwarn("No active size found in columnsAtSize - can't render content blocks");
|
|
4772
|
+
return null;
|
|
4773
|
+
}
|
|
4774
|
+
});
|
|
4775
|
+
return n_cols_currently_showing;
|
|
4776
|
+
}
|
|
4777
|
+
function $7f60f09116a3fe61$export$3f37af283f8fb843(props) {
|
|
4778
|
+
const style = $9HbP8$createMemo(() => {
|
|
4779
|
+
const {
|
|
4780
|
+
style: style,
|
|
4781
|
+
height: height,
|
|
4782
|
+
width: width,
|
|
4783
|
+
aspectRatio: aspectRatio
|
|
4784
|
+
} = props;
|
|
4785
|
+
const is_image = aspectRatio != undefined;
|
|
4786
|
+
const size_data = is_image ? {
|
|
4787
|
+
width: "100%",
|
|
4788
|
+
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
4789
|
+
} : {
|
|
4790
|
+
width: width,
|
|
4791
|
+
height: height
|
|
4792
|
+
};
|
|
4793
|
+
return {
|
|
4794
|
+
display: "block",
|
|
4795
|
+
...(style || {}),
|
|
4796
|
+
...size_data
|
|
4797
|
+
};
|
|
4798
|
+
});
|
|
4799
|
+
return $9HbP8$createComponent((0, $d20eff0aadc28983$export$acb3eaade4b23afd), {
|
|
4800
|
+
get style() {
|
|
4801
|
+
return style();
|
|
4802
|
+
},
|
|
4803
|
+
get ["class"]() {
|
|
4804
|
+
return props.class;
|
|
4805
|
+
}
|
|
4806
|
+
});
|
|
4807
|
+
}
|
|
4808
|
+
const $e7a7eb102ddc0c79$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="content-block-wrapper"></div>`, 2);
|
|
4809
|
+
function $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
|
|
4810
|
+
content_blocks_: incoming_content_blocks,
|
|
4811
|
+
cols_at_size_: cols_at_size_,
|
|
4812
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
4813
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4814
|
+
}) {
|
|
4815
|
+
// these are by row
|
|
4816
|
+
const [content_blocks, set_content_blocks] = $9HbP8$createStore([]);
|
|
4817
|
+
const n_cols_currently_showing_ = $bed740eef1769419$export$a79e666719b3647c(cols_at_size_);
|
|
4818
|
+
const products_to_rows = products => {
|
|
4819
|
+
const cols_currently_showing = n_cols_currently_showing_();
|
|
4820
|
+
if (cols_currently_showing === null) return 0;
|
|
4821
|
+
return Math.ceil(products / cols_currently_showing);
|
|
4822
|
+
};
|
|
4823
|
+
const showing_rows = $9HbP8$createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
4824
|
+
$9HbP8$createEffect(() => {
|
|
4825
|
+
const incoming_value = incoming_content_blocks();
|
|
4826
|
+
if (!incoming_value) {
|
|
4827
|
+
set_content_blocks([]);
|
|
4828
|
+
return;
|
|
4829
|
+
}
|
|
4830
|
+
const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
|
|
4831
|
+
set_content_blocks($9HbP8$reconcile(capped_value));
|
|
4832
|
+
});
|
|
4833
|
+
const get_wrapped_blocks_ = $e7a7eb102ddc0c79$var$wrap_blocks_in_div(content_blocks, n_cols_currently_showing_);
|
|
4834
|
+
$9HbP8$createComputed(() => {
|
|
4835
|
+
// 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
|
|
4836
|
+
const top_row_block = get_wrapped_blocks_()[0];
|
|
4837
|
+
const blocks_in_top_row_taken = top_row_block?.span_columns;
|
|
4838
|
+
if (blocks_in_top_row_taken == undefined) {
|
|
4839
|
+
// Fall back to zero if no content block in top row, since then no blocks in top row are taken
|
|
4840
|
+
set_top_row_shortened_by_(0);
|
|
4841
|
+
return;
|
|
4842
|
+
}
|
|
4843
|
+
set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
|
|
4844
|
+
});
|
|
4845
|
+
|
|
4846
|
+
return $e7a7eb102ddc0c79$var$remap_blocks_to_index({
|
|
4847
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
4848
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
4849
|
+
});
|
|
4850
|
+
}
|
|
4851
|
+
/**
|
|
4852
|
+
* Calculate where to put each of the finished wrapped content blocks. Also limit blocks' max width.
|
|
4853
|
+
* @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
|
|
4854
|
+
*/
|
|
4855
|
+
function $e7a7eb102ddc0c79$var$remap_blocks_to_index({
|
|
4856
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
4857
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
4858
|
+
}) {
|
|
4859
|
+
return $9HbP8$createMemo(() => {
|
|
4860
|
+
// This computation should be quite cheap since it just moves around things into an array
|
|
4861
|
+
const content_blocks_by_index = [];
|
|
4862
|
+
const constructed_block_arrays = new WeakSet();
|
|
4863
|
+
const wrapped_blocks = get_wrapped_blocks_();
|
|
4864
|
+
const cols_showing = n_cols_currently_showing_();
|
|
4865
|
+
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
4866
|
+
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
|
|
4867
|
+
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
4868
|
+
// i = row to show at
|
|
4869
|
+
const block = wrapped_blocks[i];
|
|
4870
|
+
if (!block) continue; // Array can have holes/not defined places
|
|
4871
|
+
const index_of_first_item_in_row = i * cols_showing;
|
|
4872
|
+
const index_of_last_item_in_row = index_of_first_item_in_row + cols_showing;
|
|
4873
|
+
const {
|
|
4874
|
+
span_rows: span_rows,
|
|
4875
|
+
position: position,
|
|
4876
|
+
span_columns: span_columns
|
|
4877
|
+
} = block; // span columns is already capped in the block wrapping step (wrap_blocks_in_div)
|
|
4878
|
+
let target_index;
|
|
4879
|
+
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));
|
|
4880
|
+
// Calculate displacement of us by content blocks above us
|
|
4881
|
+
let displacement_by_added_blocks = 0;
|
|
4882
|
+
for (let j = 0; j < i; j++) {
|
|
4883
|
+
const row = displaced_products[j];
|
|
4884
|
+
if (row === undefined) continue; // there were no blocks in this row
|
|
4885
|
+
let items_in_row;
|
|
4886
|
+
if (typeof row === "number") items_in_row = row;else {
|
|
4887
|
+
items_in_row = row.filter(item => item).length;
|
|
4888
|
+
displaced_products[j] = items_in_row;
|
|
4889
|
+
}
|
|
4890
|
+
displacement_by_added_blocks += items_in_row;
|
|
4891
|
+
}
|
|
4892
|
+
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
4893
|
+
for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products[i]?.[j])
|
|
4894
|
+
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
4895
|
+
displacement_by_added_blocks++;
|
|
4896
|
+
// Add block to output array at the correct index
|
|
4897
|
+
const final_target_index = target_index - displacement_by_added_blocks;
|
|
4898
|
+
const existing_block = content_blocks_by_index[final_target_index];
|
|
4899
|
+
const block_content = block.content;
|
|
4900
|
+
// 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
|
|
4901
|
+
if (existing_block) {
|
|
4902
|
+
if (constructed_block_arrays.has(existing_block))
|
|
4903
|
+
// Only push to arrays we have created to not create funky bugs when there's an array in JSX.Element
|
|
4904
|
+
existing_block.push(block_content);else {
|
|
4905
|
+
const array = [existing_block, block_content];
|
|
4906
|
+
constructed_block_arrays.add(array);
|
|
4907
|
+
content_blocks_by_index[final_target_index] = array;
|
|
4908
|
+
}
|
|
4909
|
+
} else content_blocks_by_index[final_target_index] = block_content;
|
|
4910
|
+
// Update displacement
|
|
4911
|
+
for (let j = 0; j < span_rows; j++) {
|
|
4912
|
+
const row = displaced_products[i + j] ||= [];
|
|
4913
|
+
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
4914
|
+
}
|
|
4915
|
+
}
|
|
4916
|
+
return content_blocks_by_index;
|
|
4917
|
+
});
|
|
4918
|
+
}
|
|
4919
|
+
/**
|
|
4920
|
+
* 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.
|
|
4921
|
+
* Then renders the content and wraps it into a div with the correct styling.
|
|
4922
|
+
* Also caps span_columns to max available columns
|
|
4923
|
+
*/
|
|
4924
|
+
function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
4925
|
+
const get_wrapped_blocks = $9HbP8$mapArray(() => rendered_content_blocks, block => {
|
|
4926
|
+
if (!block) return;
|
|
4927
|
+
const get_span_columns = () => Math.min(block.span_columns, max_span_columns() ?? Infinity);
|
|
4928
|
+
return $9HbP8$mergeProps1(block, {
|
|
4929
|
+
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
4930
|
+
content: (() => {
|
|
4931
|
+
const _el$ = $9HbP8$getNextElement($e7a7eb102ddc0c79$var$_tmpl$);
|
|
4932
|
+
$9HbP8$insert(_el$, $9HbP8$createComponent($e7a7eb102ddc0c79$var$RenderContent, {
|
|
4933
|
+
get content() {
|
|
4934
|
+
return block.content;
|
|
4935
|
+
}
|
|
4936
|
+
}));
|
|
4937
|
+
$9HbP8$effect(_p$ => {
|
|
4938
|
+
const _v$ = {
|
|
4939
|
+
[(0, $6dee9211e57ac31a$export$c500183c31c2b22e)]: get_span_columns()
|
|
4940
|
+
},
|
|
4941
|
+
_v$2 = `span ${get_span_columns()}`,
|
|
4942
|
+
_v$3 = `span ${block.span_rows}`;
|
|
4943
|
+
_p$._v$ = $9HbP8$style(_el$, _v$, _p$._v$);
|
|
4944
|
+
_v$2 !== _p$._v$2 && _el$.style.setProperty("grid-column", _p$._v$2 = _v$2);
|
|
4945
|
+
_v$3 !== _p$._v$3 && _el$.style.setProperty("grid-row", _p$._v$3 = _v$3);
|
|
4946
|
+
return _p$;
|
|
4947
|
+
}, {
|
|
4948
|
+
_v$: undefined,
|
|
4949
|
+
_v$2: undefined,
|
|
4950
|
+
_v$3: undefined
|
|
4951
|
+
});
|
|
4952
|
+
return _el$;
|
|
4953
|
+
})(),
|
|
4954
|
+
get span_columns() {
|
|
4955
|
+
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4956
|
+
return get_span_columns();
|
|
4957
|
+
}
|
|
4958
|
+
});
|
|
4959
|
+
});
|
|
4960
|
+
return get_wrapped_blocks;
|
|
4961
|
+
}
|
|
4962
|
+
/**
|
|
4963
|
+
* 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.
|
|
4964
|
+
*/
|
|
4965
|
+
function $e7a7eb102ddc0c79$var$RenderContent(props) {
|
|
4966
|
+
const [resource] = $9HbP8$createResource(() => props.content,
|
|
4967
|
+
// Could be reactive
|
|
4968
|
+
fn => fn());
|
|
4969
|
+
$9HbP8$createEffect(() => {
|
|
4970
|
+
if (resource.error) console.error("Error in content block rendering", resource.error);
|
|
4971
|
+
});
|
|
4972
|
+
// 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)
|
|
4973
|
+
return $9HbP8$createComponent((0, $9HbP8$Suspense), {
|
|
4974
|
+
get fallback() {
|
|
4975
|
+
return $9HbP8$createComponent((0, $7f60f09116a3fe61$export$3f37af283f8fb843), {
|
|
4976
|
+
width: "100%",
|
|
4977
|
+
height: "max(100%, 400px)"
|
|
4978
|
+
});
|
|
4979
|
+
},
|
|
4980
|
+
children: resource
|
|
4981
|
+
});
|
|
4982
|
+
}
|
|
4623
4983
|
const $2d25e42846eac370$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="PLP-results"><!#><!/><!#><!/></div>`, 6);
|
|
4624
4984
|
function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
4625
4985
|
plp_results_: plp_results_,
|
|
@@ -4635,7 +4995,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4635
4995
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
4636
4996
|
product_card_template_: product_card_template_,
|
|
4637
4997
|
layout_options_: layout_options_,
|
|
4638
|
-
id_currently_querying_for_: id_currently_querying_for_
|
|
4998
|
+
id_currently_querying_for_: id_currently_querying_for_,
|
|
4999
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
4639
5000
|
}) {
|
|
4640
5001
|
// 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
|
|
4641
5002
|
const is_loading_ = $9HbP8$createMemo(() => plp_results_.loading || query_base_.loading);
|
|
@@ -4682,20 +5043,33 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4682
5043
|
let is_just_after_plp_results_update = false;
|
|
4683
5044
|
let fallback_is_alive = false;
|
|
4684
5045
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $9HbP8$createSignal(true);
|
|
5046
|
+
const [top_row_shortened_by_, set_top_row_shortened_by_] = $9HbP8$createSignal(0);
|
|
5047
|
+
const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $9HbP8$createSignal(false);
|
|
5048
|
+
const [number_loaded_displays, set_number_loaded_displays_] = $9HbP8$createSignal(0);
|
|
5049
|
+
const modified_cols_at_size = $15aa76e6da02e5c2$export$cb5808ba002cdeed({
|
|
5050
|
+
layout_options_: layout_options_,
|
|
5051
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
5052
|
+
});
|
|
5053
|
+
const num_placeholders_ = $9HbP8$createMemo(() => {
|
|
5054
|
+
// 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
|
|
5055
|
+
return (0, $7747fe1a8c5652e3$export$6c9030e511152266) + (get_scroll_restoration_data().find(({
|
|
5056
|
+
for_id: for_id
|
|
5057
|
+
}) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
|
|
5058
|
+
});
|
|
5059
|
+
const number_of_items_shown_ = $9HbP8$createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
5060
|
+
const doesnt_have_content_blocks = $9HbP8$createMemo(() => !content_blocks_by_row_());
|
|
5061
|
+
const content_blocks_ = $9HbP8$createMemo(() => doesnt_have_content_blocks() ? () => [] : $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
|
|
5062
|
+
content_blocks_: content_blocks_by_row_,
|
|
5063
|
+
cols_at_size_: modified_cols_at_size,
|
|
5064
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
5065
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
5066
|
+
}));
|
|
4685
5067
|
const rendered_placeholders = $9HbP8$createMemo(() => get_should_have_placeholders_rendered() ? $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
5068
|
+
content_blocks_: content_blocks_,
|
|
4686
5069
|
product_card_template_: product_card_template_,
|
|
4687
|
-
num_placeholders_:
|
|
4688
|
-
// 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
|
|
4689
|
-
return (0, $7747fe1a8c5652e3$export$6c9030e511152266) + (get_scroll_restoration_data().find(({
|
|
4690
|
-
for_id: for_id
|
|
4691
|
-
}) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
|
|
4692
|
-
})
|
|
5070
|
+
num_placeholders_: num_placeholders_
|
|
4693
5071
|
}) : undefined);
|
|
4694
5072
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $9HbP8$createSignal(false);
|
|
4695
|
-
const modified_cols_at_size = $2d25e42846eac370$var$make_modified_cols_at_size({
|
|
4696
|
-
layout_options_: layout_options_,
|
|
4697
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
4698
|
-
});
|
|
4699
5073
|
const block_suspense_if_needed = () => {
|
|
4700
5074
|
if (!is_just_after_plp_results_update) return;
|
|
4701
5075
|
is_just_after_plp_results_update = false;
|
|
@@ -4728,6 +5102,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4728
5102
|
return (() => {
|
|
4729
5103
|
fallback_is_alive = true;
|
|
4730
5104
|
$9HbP8$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
5105
|
+
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
5106
|
+
$9HbP8$onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
4731
5107
|
return $9HbP8$createMemo(() => {
|
|
4732
5108
|
// 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
|
|
4733
5109
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -4752,37 +5128,64 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4752
5128
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
4753
5129
|
query_base_: query_base_,
|
|
4754
5130
|
depict_api_: depict_api_,
|
|
4755
|
-
is_loading_: is_loading_
|
|
5131
|
+
is_loading_: is_loading_,
|
|
5132
|
+
content_blocks_: content_blocks_,
|
|
5133
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4756
5134
|
});
|
|
4757
5135
|
$9HbP8$onCleanup(() => suspense_contents = undefined);
|
|
4758
5136
|
return suspense_contents;
|
|
4759
5137
|
})();
|
|
4760
5138
|
}
|
|
4761
5139
|
});
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
5140
|
+
/* 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 */
|
|
5141
|
+
const listing_contents = $9HbP8$createComponent((0, $9HbP8$Show), {
|
|
5142
|
+
get when() {
|
|
5143
|
+
return !is_loading_();
|
|
4765
5144
|
},
|
|
4766
|
-
get
|
|
4767
|
-
return
|
|
5145
|
+
get fallback() {
|
|
5146
|
+
return rendered_placeholders();
|
|
4768
5147
|
},
|
|
4769
|
-
|
|
4770
|
-
|
|
5148
|
+
children: product_cards_when_data
|
|
5149
|
+
});
|
|
5150
|
+
return [$9HbP8$memo((0, $a458486f22b22f63$export$a2cc176055f8f08)), $9HbP8$createComponent((0, $9HbP8$Show), {
|
|
5151
|
+
get when() {
|
|
5152
|
+
return doesnt_have_content_blocks();
|
|
4771
5153
|
},
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
5154
|
+
get fallback() {
|
|
5155
|
+
return $9HbP8$createComponent((0, $6dee9211e57ac31a$export$ab6b147eec64fea5), {
|
|
5156
|
+
get cols_at_size() {
|
|
5157
|
+
return modified_cols_at_size();
|
|
5158
|
+
},
|
|
5159
|
+
get override_vertical_spacing() {
|
|
5160
|
+
return layout_options_().override_vertical_spacing;
|
|
5161
|
+
},
|
|
5162
|
+
get grid_spacing() {
|
|
5163
|
+
return layout_options_().grid_spacing;
|
|
5164
|
+
},
|
|
5165
|
+
element_attributes: {
|
|
5166
|
+
class: "cards css-grid"
|
|
5167
|
+
},
|
|
5168
|
+
top_row_shortened_by_: top_row_shortened_by_,
|
|
5169
|
+
children: listing_contents
|
|
5170
|
+
});
|
|
4776
5171
|
},
|
|
4777
5172
|
get children() {
|
|
4778
|
-
return $9HbP8$createComponent((0, $
|
|
4779
|
-
get
|
|
4780
|
-
return
|
|
5173
|
+
return $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), {
|
|
5174
|
+
get cols_at_size() {
|
|
5175
|
+
return modified_cols_at_size();
|
|
5176
|
+
},
|
|
5177
|
+
get override_vertical_spacing() {
|
|
5178
|
+
return layout_options_().override_vertical_spacing;
|
|
4781
5179
|
},
|
|
4782
|
-
get
|
|
4783
|
-
return
|
|
5180
|
+
get grid_spacing() {
|
|
5181
|
+
return layout_options_().grid_spacing;
|
|
4784
5182
|
},
|
|
4785
|
-
|
|
5183
|
+
rows: "all",
|
|
5184
|
+
layout: "grid",
|
|
5185
|
+
element_attributes: {
|
|
5186
|
+
class: "cards"
|
|
5187
|
+
},
|
|
5188
|
+
children: listing_contents
|
|
4786
5189
|
});
|
|
4787
5190
|
}
|
|
4788
5191
|
})];
|
|
@@ -4795,32 +5198,6 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4795
5198
|
return _el$;
|
|
4796
5199
|
})();
|
|
4797
5200
|
}
|
|
4798
|
-
/**
|
|
4799
|
-
* Changes cols_at_size depending on if filters are open or not so one card less is shown when the filters are open
|
|
4800
|
-
* This function is special to the actual PLPResults.
|
|
4801
|
-
*/
|
|
4802
|
-
function $2d25e42846eac370$var$make_modified_cols_at_size({
|
|
4803
|
-
layout_options_: layout_options_,
|
|
4804
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
4805
|
-
}) {
|
|
4806
|
-
return $9HbP8$createMemo(() => {
|
|
4807
|
-
const layout_options = layout_options_();
|
|
4808
|
-
// Add grid styling that changes when filters get opened/closed
|
|
4809
|
-
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
4810
|
-
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
4811
|
-
const [num_cols_default,,,, override_cols] = row;
|
|
4812
|
-
const cloned_row = [...row];
|
|
4813
|
-
// @ts-ignore
|
|
4814
|
-
cloned_row[0] = num_cols_default - 1;
|
|
4815
|
-
if (override_cols)
|
|
4816
|
-
// @ts-ignore
|
|
4817
|
-
cloned_row[4] = {
|
|
4818
|
-
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(([row, column]) => [row, column - 1]))
|
|
4819
|
-
};
|
|
4820
|
-
return cloned_row;
|
|
4821
|
-
}) : when_filters_closed_cols;
|
|
4822
|
-
});
|
|
4823
|
-
}
|
|
4824
5201
|
const $68a258a92b88f02f$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="sorting-attributes"></div>`, 2),
|
|
4825
5202
|
$68a258a92b88f02f$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<div class="sorting-direction"></div>`, 2),
|
|
4826
5203
|
$68a258a92b88f02f$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div><div class="input-row"><input type="radio"><span class="custom-indicator"></span><!#><!/></div></div>`, 9),
|
|
@@ -6354,7 +6731,8 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
6354
6731
|
product_card_template_: product_card_template_,
|
|
6355
6732
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
6356
6733
|
sorting_query_param_: sorting_query_param_,
|
|
6357
|
-
filter_query_param_prefix_: filter_query_param_prefix_
|
|
6734
|
+
filter_query_param_prefix_: filter_query_param_prefix_,
|
|
6735
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
6358
6736
|
}) {
|
|
6359
6737
|
let results_for;
|
|
6360
6738
|
let only_show_filters_opener_;
|
|
@@ -6646,6 +7024,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
6646
7024
|
product_card_template_: product_card_template_,
|
|
6647
7025
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
6648
7026
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
7027
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
6649
7028
|
id_currently_querying_for_: query_id_,
|
|
6650
7029
|
no_results_options_: {
|
|
6651
7030
|
selected_filters_: selected_filters_,
|
|
@@ -7155,6 +7534,7 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
|
|
|
7155
7534
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
7156
7535
|
selected_filters_: selected_filters_,
|
|
7157
7536
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
7537
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
7158
7538
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
7159
7539
|
layout_options_: $9HbP8$createMemo(() => ({
|
|
7160
7540
|
cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77(props.cols_at_size),
|
|
@@ -7405,37 +7785,6 @@ async function $c9312089e8983364$var$download_categories(tenant, market, type) {
|
|
|
7405
7785
|
return [];
|
|
7406
7786
|
}
|
|
7407
7787
|
}
|
|
7408
|
-
function $7f60f09116a3fe61$export$3f37af283f8fb843(props) {
|
|
7409
|
-
const style = $9HbP8$createMemo(() => {
|
|
7410
|
-
const {
|
|
7411
|
-
style: style,
|
|
7412
|
-
height: height,
|
|
7413
|
-
width: width,
|
|
7414
|
-
aspectRatio: aspectRatio
|
|
7415
|
-
} = props;
|
|
7416
|
-
const is_image = aspectRatio != undefined;
|
|
7417
|
-
const size_data = is_image ? {
|
|
7418
|
-
width: "100%",
|
|
7419
|
-
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
7420
|
-
} : {
|
|
7421
|
-
width: width,
|
|
7422
|
-
height: height
|
|
7423
|
-
};
|
|
7424
|
-
return {
|
|
7425
|
-
display: "block",
|
|
7426
|
-
...(style || {}),
|
|
7427
|
-
...size_data
|
|
7428
|
-
};
|
|
7429
|
-
});
|
|
7430
|
-
return $9HbP8$createComponent((0, $d20eff0aadc28983$export$acb3eaade4b23afd), {
|
|
7431
|
-
get style() {
|
|
7432
|
-
return style();
|
|
7433
|
-
},
|
|
7434
|
-
get ["class"]() {
|
|
7435
|
-
return props.class;
|
|
7436
|
-
}
|
|
7437
|
-
});
|
|
7438
|
-
}
|
|
7439
7788
|
const $bb15dfb548a7666e$var$_tmpl$ = /*#__PURE__*/$9HbP8$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);
|
|
7440
7789
|
function $bb15dfb548a7666e$export$ee1733d9a8495996() {
|
|
7441
7790
|
return (() => {
|
|
@@ -9861,7 +10210,8 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
9861
10210
|
router_: router_,
|
|
9862
10211
|
content_results_rows_: content_results_rows_,
|
|
9863
10212
|
content_layout_options_: content_layout_options_,
|
|
9864
|
-
content_search_enabled_: content_search_enabled_
|
|
10213
|
+
content_search_enabled_: content_search_enabled_,
|
|
10214
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
9865
10215
|
}) {
|
|
9866
10216
|
const [get_sorting] = current_sorting_;
|
|
9867
10217
|
const all_products_loaded_ = $9HbP8$createSignal(false);
|
|
@@ -10140,6 +10490,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
10140
10490
|
layout_options_: layout_options_,
|
|
10141
10491
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
10142
10492
|
id_currently_querying_for_: get_search_query_,
|
|
10493
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
10143
10494
|
no_results_options_: {
|
|
10144
10495
|
selected_filters_: selected_filters_,
|
|
10145
10496
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -10585,6 +10936,7 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
|
|
|
10585
10936
|
search_sorting_open_: state_.sorting_open,
|
|
10586
10937
|
expanded_filters_: state_.expanded_filters,
|
|
10587
10938
|
content_results_rows_: state_.content_results_rows,
|
|
10939
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
10588
10940
|
router_: shared_properties.router_,
|
|
10589
10941
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
10590
10942
|
return $897bd4a76f611b38$export$d757d54550ebfb3d({
|