@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/server/latest/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { add_to_version_info as $i7OB2$add_to_version_info, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, dlog as $i7OB2$dlog, queueMacroTask as $i7OB2$queueMacroTask, catchify as $i7OB2$catchify, is_safari as $i7OB2$is_safari, observer as $i7OB2$observer, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory, slider_fractional_factory as $i7OB2$slider_fractional_factory, camelCasifyObject as $i7OB2$camelCasifyObject, make_random_classname as $i7OB2$make_random_classname, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, report as $i7OB2$report, useExpandingContainer as $i7OB2$useExpandingContainer, standard_price_format as $i7OB2$standard_price_format, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, fetch_recs as $i7OB2$fetch_recs, snakeCasifyObject as $i7OB2$snakeCasifyObject, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, base_url as $i7OB2$base_url, get_depict_id as $i7OB2$get_depict_id, get_user_id as $i7OB2$get_user_id, get_session_id as $i7OB2$get_session_id, sort_obj as $i7OB2$sort_obj, fetch_retry as $i7OB2$fetch_retry, add_version_query_params as $i7OB2$add_version_query_params, dwarn as $i7OB2$dwarn, make_url_with_query_params as $i7OB2$make_url_with_query_params, edit_current_page_meta_tags as $i7OB2$edit_current_page_meta_tags, javascript_media_query as $i7OB2$javascript_media_query, use_href_accessor as $i7OB2$use_href_accessor, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, ContainedImage as $i7OB2$ContainedImage, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, ListenableSet as $i7OB2$ListenableSet, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
|
|
2
2
|
import { createComponent as $i7OB2$createComponent, ssr as $i7OB2$ssr, ssrHydrationKey as $i7OB2$ssrHydrationKey, ssrStyle as $i7OB2$ssrStyle, ssrElement as $i7OB2$ssrElement, escape as $i7OB2$escape, insert as $i7OB2$insert, ssrAttribute as $i7OB2$ssrAttribute, mergeProps as $i7OB2$mergeProps, isServer as $i7OB2$isServer, ssrClassList as $i7OB2$ssrClassList, Dynamic as $i7OB2$Dynamic } from "solid-js/web";
|
|
3
|
-
import { createSignal as $i7OB2$createSignal, getOwner as $i7OB2$getOwner, createEffect as $i7OB2$createEffect, runWithOwner as $i7OB2$runWithOwner, onCleanup as $i7OB2$onCleanup, createMemo as $i7OB2$createMemo, createContext as $i7OB2$createContext, useContext as $i7OB2$useContext, createResource as $i7OB2$createResource, Suspense as $i7OB2$Suspense, Show as $i7OB2$Show, createRenderEffect as $i7OB2$createRenderEffect, createRoot as $i7OB2$createRoot, For as $i7OB2$For, createUniqueId as $i7OB2$createUniqueId,
|
|
3
|
+
import { createSignal as $i7OB2$createSignal, getOwner as $i7OB2$getOwner, createEffect as $i7OB2$createEffect, runWithOwner as $i7OB2$runWithOwner, onCleanup as $i7OB2$onCleanup, createMemo as $i7OB2$createMemo, createContext as $i7OB2$createContext, useContext as $i7OB2$useContext, createResource as $i7OB2$createResource, Suspense as $i7OB2$Suspense, Show as $i7OB2$Show, untrack as $i7OB2$untrack, createRenderEffect as $i7OB2$createRenderEffect, Index as $i7OB2$Index, createRoot as $i7OB2$createRoot, For as $i7OB2$For, createUniqueId as $i7OB2$createUniqueId, createComputed as $i7OB2$createComputed, ErrorBoundary as $i7OB2$ErrorBoundary, on as $i7OB2$on, batch as $i7OB2$batch, createReaction as $i7OB2$createReaction, mapArray as $i7OB2$mapArray, mergeProps as $i7OB2$mergeProps1 } from "solid-js";
|
|
4
|
+
import { createStore as $i7OB2$createStore, reconcile as $i7OB2$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_";
|
|
@@ -389,7 +390,7 @@ const $b5cccc8ee7d24677$export$6daf8749b65a1b77 = cols_at_size => {
|
|
|
389
390
|
return $b5cccc8ee7d24677$var$transform_elements(sorted_cols_at_size);
|
|
390
391
|
};
|
|
391
392
|
function $a458486f22b22f63$export$a2cc176055f8f08() {
|
|
392
|
-
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.";
|
|
393
|
+
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.";
|
|
393
394
|
return (0, $i7OB2$isServer) ? {
|
|
394
395
|
t: `<!-- ${text} -->`
|
|
395
396
|
} : document.createComment(text);
|
|
@@ -410,12 +411,13 @@ let $6e41f1fde994db72$var$cached_placeholder_element;
|
|
|
410
411
|
let $6e41f1fde994db72$var$rendering_cached_placeholder_element;
|
|
411
412
|
function $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
412
413
|
product_card_template_: product_card_template_,
|
|
413
|
-
num_placeholders_: num_placeholders_
|
|
414
|
+
num_placeholders_: num_placeholders_,
|
|
415
|
+
content_blocks_: content_blocks_
|
|
414
416
|
}) {
|
|
415
|
-
const [
|
|
416
|
-
let existing_num = 0;
|
|
417
|
+
const [num_to_actually_show, set_num_to_actually_show] = $i7OB2$createSignal($i7OB2$untrack(num_placeholders_));
|
|
417
418
|
if (0, $i7OB2$isServer)
|
|
418
419
|
// want to render simple placeholders on server, effects don't run there
|
|
420
|
+
// FIXME when adding proper SSR: also SSR content blocks
|
|
419
421
|
return $i7OB2$createMemo(() => Array.from({
|
|
420
422
|
length: num_placeholders_()
|
|
421
423
|
}).map(() => {
|
|
@@ -424,19 +426,30 @@ function $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
|
424
426
|
if (typeof template_result?.then !== "function") return template_result;
|
|
425
427
|
}));
|
|
426
428
|
$i7OB2$createRenderEffect(() => {
|
|
429
|
+
const existing_num = num_to_actually_show();
|
|
427
430
|
const to_add = num_placeholders_() - existing_num;
|
|
428
431
|
if (to_add <= 0) return;
|
|
429
432
|
// 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.
|
|
430
433
|
// 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.
|
|
431
434
|
// 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.
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
435
|
+
// 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
|
|
436
|
+
// Functionality should be the same
|
|
437
|
+
set_num_to_actually_show(existing_num + to_add);
|
|
438
|
+
});
|
|
439
|
+
return $i7OB2$createComponent((0, $i7OB2$Index), {
|
|
440
|
+
get each() {
|
|
441
|
+
return Array.from({
|
|
442
|
+
length: num_to_actually_show()
|
|
443
|
+
});
|
|
444
|
+
},
|
|
445
|
+
children: (_item, index) => {
|
|
446
|
+
const possible_content_block = $i7OB2$createMemo(() => content_blocks_?.()?.()?.[index]);
|
|
447
|
+
// Show content block before product card, so it's *at* that index
|
|
448
|
+
return [possible_content_block, $6e41f1fde994db72$var$Placeholder({
|
|
449
|
+
product_card_template_: product_card_template_
|
|
450
|
+
})]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
451
|
+
}
|
|
438
452
|
});
|
|
439
|
-
return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
440
453
|
}
|
|
441
454
|
/**
|
|
442
455
|
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
@@ -521,7 +534,8 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
|
521
534
|
merchant_: merchant_,
|
|
522
535
|
market_: market_,
|
|
523
536
|
product_card_template_: product_card_template_,
|
|
524
|
-
do_per_elements_: do_per_elements_
|
|
537
|
+
do_per_elements_: do_per_elements_,
|
|
538
|
+
content_blocks_: content_blocks_
|
|
525
539
|
}) {
|
|
526
540
|
return $i7OB2$createComponent((0, $i7OB2$For), {
|
|
527
541
|
get each() {
|
|
@@ -529,6 +543,7 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
|
529
543
|
},
|
|
530
544
|
children: (product_id, index) => {
|
|
531
545
|
const owner = $i7OB2$getOwner();
|
|
546
|
+
const possible_content_block = $i7OB2$createMemo(() => content_blocks_?.()?.()?.[index()]);
|
|
532
547
|
const display_accessor = $i7OB2$createMemo(prev => {
|
|
533
548
|
const new_display = displays_by_key_().get(product_id);
|
|
534
549
|
if (prev && $29ec7cddbe1d3484$var$deep_equal(prev, new_display))
|
|
@@ -581,7 +596,9 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
|
581
596
|
}
|
|
582
597
|
do_per_elements_?.(elements, index);
|
|
583
598
|
});
|
|
584
|
-
return
|
|
599
|
+
return [
|
|
600
|
+
// Show content block before product card, so it's *at* that index
|
|
601
|
+
possible_content_block, product_card_resource]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
585
602
|
}
|
|
586
603
|
});
|
|
587
604
|
}
|
|
@@ -3006,11 +3023,13 @@ function $90980bd87c9960f9$var$proxy_push_state(function_name, thing) {
|
|
|
3006
3023
|
thing[function_name] = new Proxy(thing[function_name], {
|
|
3007
3024
|
apply(target, this_arg, arg_list) {
|
|
3008
3025
|
try {
|
|
3009
|
-
|
|
3026
|
+
const old_state = history.state;
|
|
3027
|
+
if (typeof old_state == "object" && old_state !== null) {
|
|
3028
|
+
// This effectively disallows the user from passing in a string, number, null or undefined
|
|
3029
|
+
const intended_new_value_as_obj = typeof arg_list[0] === "object" ? arg_list[0] ?? {} : {};
|
|
3010
3030
|
const cloned_object = {
|
|
3011
|
-
...
|
|
3031
|
+
...intended_new_value_as_obj
|
|
3012
3032
|
};
|
|
3013
|
-
const old_state = history.state;
|
|
3014
3033
|
for (const key in old_state) {
|
|
3015
3034
|
if (!$90980bd87c9960f9$var$starts_with_any_prefix(key)) continue;
|
|
3016
3035
|
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
@@ -3674,7 +3693,9 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
3674
3693
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
3675
3694
|
query_base_: query_base_,
|
|
3676
3695
|
depict_api_: depict_api_,
|
|
3677
|
-
is_loading_: is_loading_
|
|
3696
|
+
is_loading_: is_loading_,
|
|
3697
|
+
content_blocks_: content_blocks_,
|
|
3698
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
3678
3699
|
}) {
|
|
3679
3700
|
// 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
|
|
3680
3701
|
const target_to_index_map = new Map();
|
|
@@ -3718,11 +3739,13 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
3718
3739
|
query_base_: query_base_,
|
|
3719
3740
|
depict_api_: depict_api_
|
|
3720
3741
|
});
|
|
3742
|
+
$i7OB2$createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
3721
3743
|
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
3722
3744
|
displays_by_key_: displays_by_key_,
|
|
3723
3745
|
merchant_: merchant_,
|
|
3724
3746
|
market_: market_,
|
|
3725
3747
|
product_card_template_: product_card_template_,
|
|
3748
|
+
content_blocks_: content_blocks_,
|
|
3726
3749
|
do_per_elements_: (elements, index_accessor) =>
|
|
3727
3750
|
// Adds/removes elements from the "results in viewport" intersection observer above
|
|
3728
3751
|
$i7OB2$createEffect(() => {
|
|
@@ -3744,6 +3767,314 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
3744
3767
|
})
|
|
3745
3768
|
});
|
|
3746
3769
|
}
|
|
3770
|
+
const $6dee9211e57ac31a$var$_tmpl$ = ["<style", ' type="text/css">', "</style>"];
|
|
3771
|
+
const $6dee9211e57ac31a$export$c500183c31c2b22e = "--spans-columns";
|
|
3772
|
+
function $6dee9211e57ac31a$export$ab6b147eec64fea5(props) {
|
|
3773
|
+
const container_class = "x" + $i7OB2$createUniqueId();
|
|
3774
|
+
const container_element_ = $i7OB2$ssrElement("div", () => ({
|
|
3775
|
+
...props.element_attributes,
|
|
3776
|
+
"classList": {
|
|
3777
|
+
[container_class]: true
|
|
3778
|
+
}
|
|
3779
|
+
}), () => $i7OB2$escape(props.children), true); // Don't want this in the error boundary below, it should only be for the actual layouting
|
|
3780
|
+
return $i7OB2$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
3781
|
+
message_: "Failed calculating css grid layout",
|
|
3782
|
+
severity_: "error",
|
|
3783
|
+
get children() {
|
|
3784
|
+
return $6dee9211e57ac31a$export$e2f22da34aaf310a(props, container_element_, false, container_class);
|
|
3785
|
+
}
|
|
3786
|
+
});
|
|
3787
|
+
}
|
|
3788
|
+
function $6dee9211e57ac31a$export$e2f22da34aaf310a(props, container_element, insert_after_container = false, container_class) {
|
|
3789
|
+
if (!container_class) {
|
|
3790
|
+
// only try to add if it wasn't provided, so that we have a code path without classList when doing SSR
|
|
3791
|
+
container_class = $i7OB2$make_random_classname();
|
|
3792
|
+
container_element.classList.add(container_class);
|
|
3793
|
+
}
|
|
3794
|
+
const container_selector = `.depict .${container_class}`; // class so ppl can have id if needed
|
|
3795
|
+
const col_styling = $i7OB2$createMemo(() => $6dee9211e57ac31a$var$generate_media_queried_declarations({
|
|
3796
|
+
container_selector_: container_selector,
|
|
3797
|
+
default_grid_spacing_text: props.grid_spacing,
|
|
3798
|
+
cols_at_size_: props.cols_at_size,
|
|
3799
|
+
override_vertical_spacing_: props.override_vertical_spacing,
|
|
3800
|
+
top_row_shortened_by_: props.top_row_shortened_by_()
|
|
3801
|
+
}));
|
|
3802
|
+
const base_styling = $i7OB2$createMemo(() => {
|
|
3803
|
+
return `${container_selector}{display:grid;}`;
|
|
3804
|
+
});
|
|
3805
|
+
const get_styling = $i7OB2$createMemo(() => base_styling() + col_styling());
|
|
3806
|
+
const style_element = $i7OB2$ssr($6dee9211e57ac31a$var$_tmpl$, $i7OB2$ssrHydrationKey(), get_styling); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
|
|
3807
|
+
if (insert_after_container) container_element.after(style_element);
|
|
3808
|
+
return [container_element, style_element];
|
|
3809
|
+
}
|
|
3810
|
+
function $6dee9211e57ac31a$var$generate_media_queried_declarations({
|
|
3811
|
+
container_selector_: container_selector_,
|
|
3812
|
+
default_grid_spacing_text: default_grid_spacing_text,
|
|
3813
|
+
cols_at_size_: cols_at_size_,
|
|
3814
|
+
override_vertical_spacing_: override_vertical_spacing_,
|
|
3815
|
+
top_row_shortened_by_: top_row_shortened_by_
|
|
3816
|
+
}) {
|
|
3817
|
+
return cols_at_size_.map(options => {
|
|
3818
|
+
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
3819
|
+
const spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
3820
|
+
// See comment in else block below
|
|
3821
|
+
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_));
|
|
3822
|
+
let spacing_styling;
|
|
3823
|
+
let additional_styling = ""; // outside the media query
|
|
3824
|
+
if (can_use_gap) spacing_styling = `gap:${spacing_to_use};${override_vertical_spacing_ ? `row-gap:${override_vertical_spacing_};` : ``}`;else {
|
|
3825
|
+
// 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)
|
|
3826
|
+
// 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.
|
|
3827
|
+
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
3828
|
+
// 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.
|
|
3829
|
+
const width_multiplier = `var(${$6dee9211e57ac31a$export$c500183c31c2b22e}, 1)`; // How many cards wide the current item is (needed because content blocks)
|
|
3830
|
+
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
|
|
3831
|
+
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
3832
|
+
const this_item_width_meat = `calc(${one_item_width_exclusing_gaps} * ${width_multiplier})`; // Width of just the card
|
|
3833
|
+
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$6dee9211e57ac31a$var$strip_percent_unit(spacing_to_use)})`; // Width of the gaps
|
|
3834
|
+
const this_item_width = `calc(${this_item_width_meat} + ${this_item_width_gaps})`; // Width of this item including gaps
|
|
3835
|
+
// 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
|
|
3836
|
+
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)
|
|
3837
|
+
spacing_styling = `column-gap:${spacing_to_use};`; // Still use gaps in the horizontal direction because that works flawlessly
|
|
3838
|
+
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
3839
|
+
additional_styling = $i7OB2$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_);
|
|
3840
|
+
}
|
|
3841
|
+
const media_query_body = `${container_selector_}{${spacing_styling}grid-template-columns:repeat(${n_cols},minmax(0,1fr));}`;
|
|
3842
|
+
return `${$i7OB2$layout_media_query_header(min, max)}{${media_query_body}}${additional_styling}`;
|
|
3843
|
+
}).join("");
|
|
3844
|
+
}
|
|
3845
|
+
function $6dee9211e57ac31a$var$can_use_gap_for_unit(spacing) {
|
|
3846
|
+
const trimmed_spacing = spacing.trim();
|
|
3847
|
+
return !trimmed_spacing.includes("%");
|
|
3848
|
+
}
|
|
3849
|
+
function $6dee9211e57ac31a$var$strip_percent_unit(css_value) {
|
|
3850
|
+
return css_value.replaceAll("%", "");
|
|
3851
|
+
}
|
|
3852
|
+
function $15aa76e6da02e5c2$export$cb5808ba002cdeed({
|
|
3853
|
+
layout_options_: layout_options_,
|
|
3854
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
3855
|
+
}) {
|
|
3856
|
+
return $i7OB2$createMemo(() => {
|
|
3857
|
+
const layout_options = layout_options_();
|
|
3858
|
+
// Add grid styling that changes when filters get opened/closed
|
|
3859
|
+
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
3860
|
+
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
3861
|
+
const [num_cols_default,,,, override_cols] = row;
|
|
3862
|
+
const cloned_row = [...row];
|
|
3863
|
+
// @ts-ignore
|
|
3864
|
+
cloned_row[0] = num_cols_default - 1;
|
|
3865
|
+
if (override_cols)
|
|
3866
|
+
// @ts-ignore
|
|
3867
|
+
cloned_row[4] = {
|
|
3868
|
+
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(([row, column]) => [row, column - 1]))
|
|
3869
|
+
};
|
|
3870
|
+
return cloned_row;
|
|
3871
|
+
}) : when_filters_closed_cols;
|
|
3872
|
+
});
|
|
3873
|
+
}
|
|
3874
|
+
function $bed740eef1769419$export$a79e666719b3647c(cols_at_size_) {
|
|
3875
|
+
const size_active = $i7OB2$createMemo(() => cols_at_size_().map(([n_cols, min_width, max_width]) => {
|
|
3876
|
+
const media_query = $i7OB2$layout_media_query_header(min_width, max_width).replaceAll("@media", "");
|
|
3877
|
+
const matches = $dc9262ef6f786812$export$d9f36cf74e24d595(media_query);
|
|
3878
|
+
return [matches, n_cols];
|
|
3879
|
+
}));
|
|
3880
|
+
const n_cols_currently_showing = $i7OB2$createMemo(() => {
|
|
3881
|
+
try {
|
|
3882
|
+
const [, n_cols_currently_showing] = size_active().find(([media_query]) => media_query());
|
|
3883
|
+
return n_cols_currently_showing;
|
|
3884
|
+
} catch (e) {
|
|
3885
|
+
$i7OB2$dwarn("No active size found in columnsAtSize - can't render content blocks");
|
|
3886
|
+
return null;
|
|
3887
|
+
}
|
|
3888
|
+
});
|
|
3889
|
+
return n_cols_currently_showing;
|
|
3890
|
+
}
|
|
3891
|
+
function $7f60f09116a3fe61$export$3f37af283f8fb843(props) {
|
|
3892
|
+
const style = $i7OB2$createMemo(() => {
|
|
3893
|
+
const {
|
|
3894
|
+
style: style,
|
|
3895
|
+
height: height,
|
|
3896
|
+
width: width,
|
|
3897
|
+
aspectRatio: aspectRatio
|
|
3898
|
+
} = props;
|
|
3899
|
+
const is_image = aspectRatio != undefined;
|
|
3900
|
+
const size_data = is_image ? {
|
|
3901
|
+
width: "100%",
|
|
3902
|
+
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
3903
|
+
} : {
|
|
3904
|
+
width: width,
|
|
3905
|
+
height: height
|
|
3906
|
+
};
|
|
3907
|
+
return {
|
|
3908
|
+
display: "block",
|
|
3909
|
+
...(style || {}),
|
|
3910
|
+
...size_data
|
|
3911
|
+
};
|
|
3912
|
+
});
|
|
3913
|
+
return $i7OB2$createComponent((0, $d20eff0aadc28983$export$acb3eaade4b23afd), {
|
|
3914
|
+
get style() {
|
|
3915
|
+
return style();
|
|
3916
|
+
},
|
|
3917
|
+
get ["class"]() {
|
|
3918
|
+
return props.class;
|
|
3919
|
+
}
|
|
3920
|
+
});
|
|
3921
|
+
}
|
|
3922
|
+
const $e7a7eb102ddc0c79$var$_tmpl$ = ["<div", ' class="content-block-wrapper" style="', '">', "</div>"];
|
|
3923
|
+
function $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
|
|
3924
|
+
content_blocks_: incoming_content_blocks,
|
|
3925
|
+
cols_at_size_: cols_at_size_,
|
|
3926
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
3927
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
3928
|
+
}) {
|
|
3929
|
+
// these are by row
|
|
3930
|
+
const [content_blocks, set_content_blocks] = $i7OB2$createStore([]);
|
|
3931
|
+
const n_cols_currently_showing_ = $bed740eef1769419$export$a79e666719b3647c(cols_at_size_);
|
|
3932
|
+
const products_to_rows = products => {
|
|
3933
|
+
const cols_currently_showing = n_cols_currently_showing_();
|
|
3934
|
+
if (cols_currently_showing === null) return 0;
|
|
3935
|
+
return Math.ceil(products / cols_currently_showing);
|
|
3936
|
+
};
|
|
3937
|
+
const showing_rows = $i7OB2$createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
3938
|
+
$i7OB2$createEffect(() => {
|
|
3939
|
+
const incoming_value = incoming_content_blocks();
|
|
3940
|
+
if (!incoming_value) {
|
|
3941
|
+
set_content_blocks([]);
|
|
3942
|
+
return;
|
|
3943
|
+
}
|
|
3944
|
+
const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
|
|
3945
|
+
set_content_blocks($i7OB2$reconcile(capped_value));
|
|
3946
|
+
});
|
|
3947
|
+
const get_wrapped_blocks_ = $e7a7eb102ddc0c79$var$wrap_blocks_in_div(content_blocks, n_cols_currently_showing_);
|
|
3948
|
+
$i7OB2$createComputed(() => {
|
|
3949
|
+
// 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
|
|
3950
|
+
const top_row_block = get_wrapped_blocks_()[0];
|
|
3951
|
+
const blocks_in_top_row_taken = top_row_block?.span_columns;
|
|
3952
|
+
if (blocks_in_top_row_taken == undefined) {
|
|
3953
|
+
// Fall back to zero if no content block in top row, since then no blocks in top row are taken
|
|
3954
|
+
set_top_row_shortened_by_(0);
|
|
3955
|
+
return;
|
|
3956
|
+
}
|
|
3957
|
+
set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
|
|
3958
|
+
});
|
|
3959
|
+
|
|
3960
|
+
return $e7a7eb102ddc0c79$var$remap_blocks_to_index({
|
|
3961
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
3962
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
3963
|
+
});
|
|
3964
|
+
}
|
|
3965
|
+
/**
|
|
3966
|
+
* Calculate where to put each of the finished wrapped content blocks. Also limit blocks' max width.
|
|
3967
|
+
* @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
|
|
3968
|
+
*/
|
|
3969
|
+
function $e7a7eb102ddc0c79$var$remap_blocks_to_index({
|
|
3970
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
3971
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
3972
|
+
}) {
|
|
3973
|
+
return $i7OB2$createMemo(() => {
|
|
3974
|
+
// This computation should be quite cheap since it just moves around things into an array
|
|
3975
|
+
const content_blocks_by_index = [];
|
|
3976
|
+
const constructed_block_arrays = new WeakSet();
|
|
3977
|
+
const wrapped_blocks = get_wrapped_blocks_();
|
|
3978
|
+
const cols_showing = n_cols_currently_showing_();
|
|
3979
|
+
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
3980
|
+
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
|
|
3981
|
+
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
3982
|
+
// i = row to show at
|
|
3983
|
+
const block = wrapped_blocks[i];
|
|
3984
|
+
if (!block) continue; // Array can have holes/not defined places
|
|
3985
|
+
const index_of_first_item_in_row = i * cols_showing;
|
|
3986
|
+
const index_of_last_item_in_row = index_of_first_item_in_row + cols_showing;
|
|
3987
|
+
const {
|
|
3988
|
+
span_rows: span_rows,
|
|
3989
|
+
position: position,
|
|
3990
|
+
span_columns: span_columns
|
|
3991
|
+
} = block; // span columns is already capped in the block wrapping step (wrap_blocks_in_div)
|
|
3992
|
+
let target_index;
|
|
3993
|
+
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));
|
|
3994
|
+
// Calculate displacement of us by content blocks above us
|
|
3995
|
+
let displacement_by_added_blocks = 0;
|
|
3996
|
+
for (let j = 0; j < i; j++) {
|
|
3997
|
+
const row = displaced_products[j];
|
|
3998
|
+
if (row === undefined) continue; // there were no blocks in this row
|
|
3999
|
+
let items_in_row;
|
|
4000
|
+
if (typeof row === "number") items_in_row = row;else {
|
|
4001
|
+
items_in_row = row.filter(item => item).length;
|
|
4002
|
+
displaced_products[j] = items_in_row;
|
|
4003
|
+
}
|
|
4004
|
+
displacement_by_added_blocks += items_in_row;
|
|
4005
|
+
}
|
|
4006
|
+
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
4007
|
+
for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products[i]?.[j])
|
|
4008
|
+
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
4009
|
+
displacement_by_added_blocks++;
|
|
4010
|
+
// Add block to output array at the correct index
|
|
4011
|
+
const final_target_index = target_index - displacement_by_added_blocks;
|
|
4012
|
+
const existing_block = content_blocks_by_index[final_target_index];
|
|
4013
|
+
const block_content = block.content;
|
|
4014
|
+
// 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
|
|
4015
|
+
if (existing_block) {
|
|
4016
|
+
if (constructed_block_arrays.has(existing_block))
|
|
4017
|
+
// Only push to arrays we have created to not create funky bugs when there's an array in JSX.Element
|
|
4018
|
+
existing_block.push(block_content);else {
|
|
4019
|
+
const array = [existing_block, block_content];
|
|
4020
|
+
constructed_block_arrays.add(array);
|
|
4021
|
+
content_blocks_by_index[final_target_index] = array;
|
|
4022
|
+
}
|
|
4023
|
+
} else content_blocks_by_index[final_target_index] = block_content;
|
|
4024
|
+
// Update displacement
|
|
4025
|
+
for (let j = 0; j < span_rows; j++) {
|
|
4026
|
+
const row = displaced_products[i + j] ||= [];
|
|
4027
|
+
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
return content_blocks_by_index;
|
|
4031
|
+
});
|
|
4032
|
+
}
|
|
4033
|
+
/**
|
|
4034
|
+
* 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.
|
|
4035
|
+
* Then renders the content and wraps it into a div with the correct styling.
|
|
4036
|
+
* Also caps span_columns to max available columns
|
|
4037
|
+
*/
|
|
4038
|
+
function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
4039
|
+
const get_wrapped_blocks = $i7OB2$mapArray(() => rendered_content_blocks, block => {
|
|
4040
|
+
if (!block) return;
|
|
4041
|
+
const get_span_columns = () => Math.min(block.span_columns, max_span_columns() ?? Infinity);
|
|
4042
|
+
return $i7OB2$mergeProps1(block, {
|
|
4043
|
+
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
4044
|
+
content: $i7OB2$ssr($e7a7eb102ddc0c79$var$_tmpl$, $i7OB2$ssrHydrationKey(), "grid-column:" + `span ${$i7OB2$escape(get_span_columns(), true)}` + (";grid-row:" + `span ${$i7OB2$escape(block.span_rows, true)}`) + (";spans_columns_variable_name:" + $i7OB2$escape(get_span_columns(), true)), $i7OB2$escape($i7OB2$createComponent($e7a7eb102ddc0c79$var$RenderContent, {
|
|
4045
|
+
get content() {
|
|
4046
|
+
return block.content;
|
|
4047
|
+
}
|
|
4048
|
+
}))),
|
|
4049
|
+
get span_columns() {
|
|
4050
|
+
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4051
|
+
return get_span_columns();
|
|
4052
|
+
}
|
|
4053
|
+
});
|
|
4054
|
+
});
|
|
4055
|
+
return get_wrapped_blocks;
|
|
4056
|
+
}
|
|
4057
|
+
/**
|
|
4058
|
+
* 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.
|
|
4059
|
+
*/
|
|
4060
|
+
function $e7a7eb102ddc0c79$var$RenderContent(props) {
|
|
4061
|
+
const [resource] = $i7OB2$createResource(() => props.content,
|
|
4062
|
+
// Could be reactive
|
|
4063
|
+
fn => fn());
|
|
4064
|
+
$i7OB2$createEffect(() => {
|
|
4065
|
+
if (resource.error) console.error("Error in content block rendering", resource.error);
|
|
4066
|
+
});
|
|
4067
|
+
// 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)
|
|
4068
|
+
return $i7OB2$createComponent((0, $i7OB2$Suspense), {
|
|
4069
|
+
get fallback() {
|
|
4070
|
+
return $i7OB2$createComponent((0, $7f60f09116a3fe61$export$3f37af283f8fb843), {
|
|
4071
|
+
width: "100%",
|
|
4072
|
+
height: "max(100%, 400px)"
|
|
4073
|
+
});
|
|
4074
|
+
},
|
|
4075
|
+
children: resource
|
|
4076
|
+
});
|
|
4077
|
+
}
|
|
3747
4078
|
const $2d25e42846eac370$var$_tmpl$ = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"];
|
|
3748
4079
|
function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
3749
4080
|
plp_results_: plp_results_,
|
|
@@ -3759,7 +4090,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
3759
4090
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
3760
4091
|
product_card_template_: product_card_template_,
|
|
3761
4092
|
layout_options_: layout_options_,
|
|
3762
|
-
id_currently_querying_for_: id_currently_querying_for_
|
|
4093
|
+
id_currently_querying_for_: id_currently_querying_for_,
|
|
4094
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
3763
4095
|
}) {
|
|
3764
4096
|
// 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
|
|
3765
4097
|
const is_loading_ = $i7OB2$createMemo(() => plp_results_.loading || query_base_.loading);
|
|
@@ -3800,20 +4132,33 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
3800
4132
|
let is_just_after_plp_results_update = false;
|
|
3801
4133
|
let fallback_is_alive = false;
|
|
3802
4134
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $i7OB2$createSignal(true);
|
|
4135
|
+
const [top_row_shortened_by_, set_top_row_shortened_by_] = $i7OB2$createSignal(0);
|
|
4136
|
+
const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $i7OB2$createSignal(false);
|
|
4137
|
+
const [number_loaded_displays, set_number_loaded_displays_] = $i7OB2$createSignal(0);
|
|
4138
|
+
const modified_cols_at_size = $15aa76e6da02e5c2$export$cb5808ba002cdeed({
|
|
4139
|
+
layout_options_: layout_options_,
|
|
4140
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
4141
|
+
});
|
|
4142
|
+
const num_placeholders_ = $i7OB2$createMemo(() => {
|
|
4143
|
+
// 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
|
|
4144
|
+
return (0, $7747fe1a8c5652e3$export$6c9030e511152266) + (get_scroll_restoration_data().find(({
|
|
4145
|
+
for_id: for_id
|
|
4146
|
+
}) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
|
|
4147
|
+
});
|
|
4148
|
+
const number_of_items_shown_ = $i7OB2$createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
4149
|
+
const doesnt_have_content_blocks = $i7OB2$createMemo(() => !content_blocks_by_row_());
|
|
4150
|
+
const content_blocks_ = $i7OB2$createMemo(() => doesnt_have_content_blocks() ? () => [] : $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
|
|
4151
|
+
content_blocks_: content_blocks_by_row_,
|
|
4152
|
+
cols_at_size_: modified_cols_at_size,
|
|
4153
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
4154
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4155
|
+
}));
|
|
3803
4156
|
const rendered_placeholders = $i7OB2$createMemo(() => get_should_have_placeholders_rendered() ? $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
4157
|
+
content_blocks_: content_blocks_,
|
|
3804
4158
|
product_card_template_: product_card_template_,
|
|
3805
|
-
num_placeholders_:
|
|
3806
|
-
// 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
|
|
3807
|
-
return (0, $7747fe1a8c5652e3$export$6c9030e511152266) + (get_scroll_restoration_data().find(({
|
|
3808
|
-
for_id: for_id
|
|
3809
|
-
}) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
|
|
3810
|
-
})
|
|
4159
|
+
num_placeholders_: num_placeholders_
|
|
3811
4160
|
}) : undefined);
|
|
3812
4161
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $i7OB2$createSignal(false);
|
|
3813
|
-
const modified_cols_at_size = $2d25e42846eac370$var$make_modified_cols_at_size({
|
|
3814
|
-
layout_options_: layout_options_,
|
|
3815
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
3816
|
-
});
|
|
3817
4162
|
const block_suspense_if_needed = () => {
|
|
3818
4163
|
if (!is_just_after_plp_results_update) return;
|
|
3819
4164
|
is_just_after_plp_results_update = false;
|
|
@@ -3846,6 +4191,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
3846
4191
|
return (() => {
|
|
3847
4192
|
fallback_is_alive = true;
|
|
3848
4193
|
$i7OB2$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4194
|
+
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
4195
|
+
$i7OB2$onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
3849
4196
|
return $i7OB2$createMemo(() => {
|
|
3850
4197
|
// 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
|
|
3851
4198
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -3870,37 +4217,64 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
3870
4217
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
3871
4218
|
query_base_: query_base_,
|
|
3872
4219
|
depict_api_: depict_api_,
|
|
3873
|
-
is_loading_: is_loading_
|
|
4220
|
+
is_loading_: is_loading_,
|
|
4221
|
+
content_blocks_: content_blocks_,
|
|
4222
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
3874
4223
|
});
|
|
3875
4224
|
$i7OB2$onCleanup(() => suspense_contents = undefined);
|
|
3876
4225
|
return suspense_contents;
|
|
3877
4226
|
})();
|
|
3878
4227
|
}
|
|
3879
4228
|
});
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
4229
|
+
/* 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 */
|
|
4230
|
+
const listing_contents = $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
4231
|
+
get when() {
|
|
4232
|
+
return !is_loading_();
|
|
3883
4233
|
},
|
|
3884
|
-
get
|
|
3885
|
-
return
|
|
4234
|
+
get fallback() {
|
|
4235
|
+
return rendered_placeholders();
|
|
3886
4236
|
},
|
|
3887
|
-
|
|
3888
|
-
|
|
4237
|
+
children: product_cards_when_data
|
|
4238
|
+
});
|
|
4239
|
+
return [$a458486f22b22f63$export$a2cc176055f8f08(), $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
4240
|
+
get when() {
|
|
4241
|
+
return doesnt_have_content_blocks();
|
|
3889
4242
|
},
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
4243
|
+
get fallback() {
|
|
4244
|
+
return $i7OB2$createComponent((0, $6dee9211e57ac31a$export$ab6b147eec64fea5), {
|
|
4245
|
+
get cols_at_size() {
|
|
4246
|
+
return modified_cols_at_size();
|
|
4247
|
+
},
|
|
4248
|
+
get override_vertical_spacing() {
|
|
4249
|
+
return layout_options_().override_vertical_spacing;
|
|
4250
|
+
},
|
|
4251
|
+
get grid_spacing() {
|
|
4252
|
+
return layout_options_().grid_spacing;
|
|
4253
|
+
},
|
|
4254
|
+
element_attributes: {
|
|
4255
|
+
class: "cards css-grid"
|
|
4256
|
+
},
|
|
4257
|
+
top_row_shortened_by_: top_row_shortened_by_,
|
|
4258
|
+
children: listing_contents
|
|
4259
|
+
});
|
|
3894
4260
|
},
|
|
3895
4261
|
get children() {
|
|
3896
|
-
return $i7OB2$createComponent((0, $
|
|
3897
|
-
get
|
|
3898
|
-
return
|
|
4262
|
+
return $i7OB2$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), {
|
|
4263
|
+
get cols_at_size() {
|
|
4264
|
+
return modified_cols_at_size();
|
|
4265
|
+
},
|
|
4266
|
+
get override_vertical_spacing() {
|
|
4267
|
+
return layout_options_().override_vertical_spacing;
|
|
4268
|
+
},
|
|
4269
|
+
get grid_spacing() {
|
|
4270
|
+
return layout_options_().grid_spacing;
|
|
3899
4271
|
},
|
|
3900
|
-
|
|
3901
|
-
|
|
4272
|
+
rows: "all",
|
|
4273
|
+
layout: "grid",
|
|
4274
|
+
element_attributes: {
|
|
4275
|
+
class: "cards"
|
|
3902
4276
|
},
|
|
3903
|
-
children:
|
|
4277
|
+
children: listing_contents
|
|
3904
4278
|
});
|
|
3905
4279
|
}
|
|
3906
4280
|
})];
|
|
@@ -3909,32 +4283,6 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
3909
4283
|
}
|
|
3910
4284
|
})), $i7OB2$escape(desktop_filter_elements_()));
|
|
3911
4285
|
}
|
|
3912
|
-
/**
|
|
3913
|
-
* Changes cols_at_size depending on if filters are open or not so one card less is shown when the filters are open
|
|
3914
|
-
* This function is special to the actual PLPResults.
|
|
3915
|
-
*/
|
|
3916
|
-
function $2d25e42846eac370$var$make_modified_cols_at_size({
|
|
3917
|
-
layout_options_: layout_options_,
|
|
3918
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
3919
|
-
}) {
|
|
3920
|
-
return $i7OB2$createMemo(() => {
|
|
3921
|
-
const layout_options = layout_options_();
|
|
3922
|
-
// Add grid styling that changes when filters get opened/closed
|
|
3923
|
-
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
3924
|
-
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
3925
|
-
const [num_cols_default,,,, override_cols] = row;
|
|
3926
|
-
const cloned_row = [...row];
|
|
3927
|
-
// @ts-ignore
|
|
3928
|
-
cloned_row[0] = num_cols_default - 1;
|
|
3929
|
-
if (override_cols)
|
|
3930
|
-
// @ts-ignore
|
|
3931
|
-
cloned_row[4] = {
|
|
3932
|
-
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(([row, column]) => [row, column - 1]))
|
|
3933
|
-
};
|
|
3934
|
-
return cloned_row;
|
|
3935
|
-
}) : when_filters_closed_cols;
|
|
3936
|
-
});
|
|
3937
|
-
}
|
|
3938
4286
|
const $68a258a92b88f02f$var$_tmpl$ = ["<div", ' class="sorting-attributes">', "</div>"],
|
|
3939
4287
|
$68a258a92b88f02f$var$_tmpl$2 = ["<div", ' class="sorting-direction">', "</div>"],
|
|
3940
4288
|
$68a258a92b88f02f$var$_tmpl$3 = ["<div", '><div class="input-row"><input type="radio"', '><span class="custom-indicator"></span><!--#-->', "<!--/--></div></div>"],
|
|
@@ -5122,7 +5470,8 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
5122
5470
|
product_card_template_: product_card_template_,
|
|
5123
5471
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
5124
5472
|
sorting_query_param_: sorting_query_param_,
|
|
5125
|
-
filter_query_param_prefix_: filter_query_param_prefix_
|
|
5473
|
+
filter_query_param_prefix_: filter_query_param_prefix_,
|
|
5474
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
5126
5475
|
}) {
|
|
5127
5476
|
let results_for;
|
|
5128
5477
|
let only_show_filters_opener_;
|
|
@@ -5370,6 +5719,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
5370
5719
|
product_card_template_: product_card_template_,
|
|
5371
5720
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
5372
5721
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
5722
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
5373
5723
|
id_currently_querying_for_: query_id_,
|
|
5374
5724
|
no_results_options_: {
|
|
5375
5725
|
selected_filters_: selected_filters_,
|
|
@@ -5869,6 +6219,7 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
|
|
|
5869
6219
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
5870
6220
|
selected_filters_: selected_filters_,
|
|
5871
6221
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
6222
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
5872
6223
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
5873
6224
|
layout_options_: $i7OB2$createMemo(() => ({
|
|
5874
6225
|
cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77(props.cols_at_size),
|
|
@@ -6095,37 +6446,6 @@ async function $c9312089e8983364$var$download_categories(tenant, market, type) {
|
|
|
6095
6446
|
return [];
|
|
6096
6447
|
}
|
|
6097
6448
|
}
|
|
6098
|
-
function $7f60f09116a3fe61$export$3f37af283f8fb843(props) {
|
|
6099
|
-
const style = $i7OB2$createMemo(() => {
|
|
6100
|
-
const {
|
|
6101
|
-
style: style,
|
|
6102
|
-
height: height,
|
|
6103
|
-
width: width,
|
|
6104
|
-
aspectRatio: aspectRatio
|
|
6105
|
-
} = props;
|
|
6106
|
-
const is_image = aspectRatio != undefined;
|
|
6107
|
-
const size_data = is_image ? {
|
|
6108
|
-
width: "100%",
|
|
6109
|
-
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
6110
|
-
} : {
|
|
6111
|
-
width: width,
|
|
6112
|
-
height: height
|
|
6113
|
-
};
|
|
6114
|
-
return {
|
|
6115
|
-
display: "block",
|
|
6116
|
-
...(style || {}),
|
|
6117
|
-
...size_data
|
|
6118
|
-
};
|
|
6119
|
-
});
|
|
6120
|
-
return $i7OB2$createComponent((0, $d20eff0aadc28983$export$acb3eaade4b23afd), {
|
|
6121
|
-
get style() {
|
|
6122
|
-
return style();
|
|
6123
|
-
},
|
|
6124
|
-
get ["class"]() {
|
|
6125
|
-
return props.class;
|
|
6126
|
-
}
|
|
6127
|
-
});
|
|
6128
|
-
}
|
|
6129
6449
|
const $bb15dfb548a7666e$var$_tmpl$ = ["<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>"];
|
|
6130
6450
|
function $bb15dfb548a7666e$export$ee1733d9a8495996() {
|
|
6131
6451
|
return $i7OB2$ssr($bb15dfb548a7666e$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $7f60f09116a3fe61$export$3f37af283f8fb843), {
|
|
@@ -7995,7 +8315,8 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
7995
8315
|
router_: router_,
|
|
7996
8316
|
content_results_rows_: content_results_rows_,
|
|
7997
8317
|
content_layout_options_: content_layout_options_,
|
|
7998
|
-
content_search_enabled_: content_search_enabled_
|
|
8318
|
+
content_search_enabled_: content_search_enabled_,
|
|
8319
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
7999
8320
|
}) {
|
|
8000
8321
|
const [get_sorting] = current_sorting_;
|
|
8001
8322
|
const all_products_loaded_ = $i7OB2$createSignal(false);
|
|
@@ -8239,6 +8560,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8239
8560
|
layout_options_: layout_options_,
|
|
8240
8561
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
8241
8562
|
id_currently_querying_for_: get_search_query_,
|
|
8563
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
8242
8564
|
no_results_options_: {
|
|
8243
8565
|
selected_filters_: selected_filters_,
|
|
8244
8566
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -8678,6 +9000,7 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
|
|
|
8678
9000
|
search_sorting_open_: state_.sorting_open,
|
|
8679
9001
|
expanded_filters_: state_.expanded_filters,
|
|
8680
9002
|
content_results_rows_: state_.content_results_rows,
|
|
9003
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
8681
9004
|
router_: shared_properties.router_,
|
|
8682
9005
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
8683
9006
|
return $897bd4a76f611b38$export$d757d54550ebfb3d({
|