@depict-ai/ui 2.0.26 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ES10/index.cjs +483 -111
- package/ES10/index.d.ts +75 -45
- package/ES10/index.js +484 -112
- package/latest/index.cjs +453 -103
- package/latest/index.d.ts +75 -45
- package/latest/index.js +454 -104
- package/locales/require.js +1152 -0
- package/package.json +4 -4
- package/server/ES10/index.cjs +454 -111
- package/server/ES10/index.d.ts +75 -45
- package/server/ES10/index.js +455 -112
- package/server/latest/index.cjs +424 -103
- package/server/latest/index.d.ts +75 -45
- package/server/latest/index.js +425 -104
package/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
|
}
|
|
@@ -4552,7 +4569,9 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
4552
4569
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
4553
4570
|
query_base_: query_base_,
|
|
4554
4571
|
depict_api_: depict_api_,
|
|
4555
|
-
is_loading_: is_loading_
|
|
4572
|
+
is_loading_: is_loading_,
|
|
4573
|
+
content_blocks_: content_blocks_,
|
|
4574
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4556
4575
|
}) {
|
|
4557
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
|
|
4558
4577
|
const target_to_index_map = new Map();
|
|
@@ -4596,11 +4615,13 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
4596
4615
|
query_base_: query_base_,
|
|
4597
4616
|
depict_api_: depict_api_
|
|
4598
4617
|
});
|
|
4618
|
+
$9HbP8$createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
4599
4619
|
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
4600
4620
|
displays_by_key_: displays_by_key_,
|
|
4601
4621
|
merchant_: merchant_,
|
|
4602
4622
|
market_: market_,
|
|
4603
4623
|
product_card_template_: product_card_template_,
|
|
4624
|
+
content_blocks_: content_blocks_,
|
|
4604
4625
|
do_per_elements_: (elements, index_accessor) =>
|
|
4605
4626
|
// Adds/removes elements from the "results in viewport" intersection observer above
|
|
4606
4627
|
$9HbP8$createEffect(() => {
|
|
@@ -4622,6 +4643,343 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
4622
4643
|
})
|
|
4623
4644
|
});
|
|
4624
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
|
+
}
|
|
4625
4983
|
const $2d25e42846eac370$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="PLP-results"><!#><!/><!#><!/></div>`, 6);
|
|
4626
4984
|
function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
4627
4985
|
plp_results_: plp_results_,
|
|
@@ -4637,7 +4995,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4637
4995
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
4638
4996
|
product_card_template_: product_card_template_,
|
|
4639
4997
|
layout_options_: layout_options_,
|
|
4640
|
-
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_
|
|
4641
5000
|
}) {
|
|
4642
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
|
|
4643
5002
|
const is_loading_ = $9HbP8$createMemo(() => plp_results_.loading || query_base_.loading);
|
|
@@ -4684,20 +5043,33 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4684
5043
|
let is_just_after_plp_results_update = false;
|
|
4685
5044
|
let fallback_is_alive = false;
|
|
4686
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
|
+
}));
|
|
4687
5067
|
const rendered_placeholders = $9HbP8$createMemo(() => get_should_have_placeholders_rendered() ? $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
5068
|
+
content_blocks_: content_blocks_,
|
|
4688
5069
|
product_card_template_: product_card_template_,
|
|
4689
|
-
num_placeholders_:
|
|
4690
|
-
// 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
|
|
4691
|
-
return (0, $7747fe1a8c5652e3$export$6c9030e511152266) + (get_scroll_restoration_data().find(({
|
|
4692
|
-
for_id: for_id
|
|
4693
|
-
}) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
|
|
4694
|
-
})
|
|
5070
|
+
num_placeholders_: num_placeholders_
|
|
4695
5071
|
}) : undefined);
|
|
4696
5072
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $9HbP8$createSignal(false);
|
|
4697
|
-
const modified_cols_at_size = $2d25e42846eac370$var$make_modified_cols_at_size({
|
|
4698
|
-
layout_options_: layout_options_,
|
|
4699
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
4700
|
-
});
|
|
4701
5073
|
const block_suspense_if_needed = () => {
|
|
4702
5074
|
if (!is_just_after_plp_results_update) return;
|
|
4703
5075
|
is_just_after_plp_results_update = false;
|
|
@@ -4730,6 +5102,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4730
5102
|
return (() => {
|
|
4731
5103
|
fallback_is_alive = true;
|
|
4732
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));
|
|
4733
5107
|
return $9HbP8$createMemo(() => {
|
|
4734
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
|
|
4735
5109
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -4754,37 +5128,64 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4754
5128
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
4755
5129
|
query_base_: query_base_,
|
|
4756
5130
|
depict_api_: depict_api_,
|
|
4757
|
-
is_loading_: is_loading_
|
|
5131
|
+
is_loading_: is_loading_,
|
|
5132
|
+
content_blocks_: content_blocks_,
|
|
5133
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4758
5134
|
});
|
|
4759
5135
|
$9HbP8$onCleanup(() => suspense_contents = undefined);
|
|
4760
5136
|
return suspense_contents;
|
|
4761
5137
|
})();
|
|
4762
5138
|
}
|
|
4763
5139
|
});
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
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_();
|
|
4767
5144
|
},
|
|
4768
|
-
get
|
|
4769
|
-
return
|
|
5145
|
+
get fallback() {
|
|
5146
|
+
return rendered_placeholders();
|
|
4770
5147
|
},
|
|
4771
|
-
|
|
4772
|
-
|
|
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();
|
|
4773
5153
|
},
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
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
|
+
});
|
|
4778
5171
|
},
|
|
4779
5172
|
get children() {
|
|
4780
|
-
return $9HbP8$createComponent((0, $
|
|
4781
|
-
get
|
|
4782
|
-
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;
|
|
4783
5179
|
},
|
|
4784
|
-
get
|
|
4785
|
-
return
|
|
5180
|
+
get grid_spacing() {
|
|
5181
|
+
return layout_options_().grid_spacing;
|
|
4786
5182
|
},
|
|
4787
|
-
|
|
5183
|
+
rows: "all",
|
|
5184
|
+
layout: "grid",
|
|
5185
|
+
element_attributes: {
|
|
5186
|
+
class: "cards"
|
|
5187
|
+
},
|
|
5188
|
+
children: listing_contents
|
|
4788
5189
|
});
|
|
4789
5190
|
}
|
|
4790
5191
|
})];
|
|
@@ -4797,32 +5198,6 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4797
5198
|
return _el$;
|
|
4798
5199
|
})();
|
|
4799
5200
|
}
|
|
4800
|
-
/**
|
|
4801
|
-
* Changes cols_at_size depending on if filters are open or not so one card less is shown when the filters are open
|
|
4802
|
-
* This function is special to the actual PLPResults.
|
|
4803
|
-
*/
|
|
4804
|
-
function $2d25e42846eac370$var$make_modified_cols_at_size({
|
|
4805
|
-
layout_options_: layout_options_,
|
|
4806
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
4807
|
-
}) {
|
|
4808
|
-
return $9HbP8$createMemo(() => {
|
|
4809
|
-
const layout_options = layout_options_();
|
|
4810
|
-
// Add grid styling that changes when filters get opened/closed
|
|
4811
|
-
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
4812
|
-
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
4813
|
-
const [num_cols_default,,,, override_cols] = row;
|
|
4814
|
-
const cloned_row = [...row];
|
|
4815
|
-
// @ts-ignore
|
|
4816
|
-
cloned_row[0] = num_cols_default - 1;
|
|
4817
|
-
if (override_cols)
|
|
4818
|
-
// @ts-ignore
|
|
4819
|
-
cloned_row[4] = {
|
|
4820
|
-
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(([row, column]) => [row, column - 1]))
|
|
4821
|
-
};
|
|
4822
|
-
return cloned_row;
|
|
4823
|
-
}) : when_filters_closed_cols;
|
|
4824
|
-
});
|
|
4825
|
-
}
|
|
4826
5201
|
const $68a258a92b88f02f$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="sorting-attributes"></div>`, 2),
|
|
4827
5202
|
$68a258a92b88f02f$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<div class="sorting-direction"></div>`, 2),
|
|
4828
5203
|
$68a258a92b88f02f$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div><div class="input-row"><input type="radio"><span class="custom-indicator"></span><!#><!/></div></div>`, 9),
|
|
@@ -6356,7 +6731,8 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
6356
6731
|
product_card_template_: product_card_template_,
|
|
6357
6732
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
6358
6733
|
sorting_query_param_: sorting_query_param_,
|
|
6359
|
-
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_
|
|
6360
6736
|
}) {
|
|
6361
6737
|
let results_for;
|
|
6362
6738
|
let only_show_filters_opener_;
|
|
@@ -6648,6 +7024,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
6648
7024
|
product_card_template_: product_card_template_,
|
|
6649
7025
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
6650
7026
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
7027
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
6651
7028
|
id_currently_querying_for_: query_id_,
|
|
6652
7029
|
no_results_options_: {
|
|
6653
7030
|
selected_filters_: selected_filters_,
|
|
@@ -7157,6 +7534,7 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
|
|
|
7157
7534
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
7158
7535
|
selected_filters_: selected_filters_,
|
|
7159
7536
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
7537
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
7160
7538
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
7161
7539
|
layout_options_: $9HbP8$createMemo(() => ({
|
|
7162
7540
|
cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77(props.cols_at_size),
|
|
@@ -7407,37 +7785,6 @@ async function $c9312089e8983364$var$download_categories(tenant, market, type) {
|
|
|
7407
7785
|
return [];
|
|
7408
7786
|
}
|
|
7409
7787
|
}
|
|
7410
|
-
function $7f60f09116a3fe61$export$3f37af283f8fb843(props) {
|
|
7411
|
-
const style = $9HbP8$createMemo(() => {
|
|
7412
|
-
const {
|
|
7413
|
-
style: style,
|
|
7414
|
-
height: height,
|
|
7415
|
-
width: width,
|
|
7416
|
-
aspectRatio: aspectRatio
|
|
7417
|
-
} = props;
|
|
7418
|
-
const is_image = aspectRatio != undefined;
|
|
7419
|
-
const size_data = is_image ? {
|
|
7420
|
-
width: "100%",
|
|
7421
|
-
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
7422
|
-
} : {
|
|
7423
|
-
width: width,
|
|
7424
|
-
height: height
|
|
7425
|
-
};
|
|
7426
|
-
return {
|
|
7427
|
-
display: "block",
|
|
7428
|
-
...(style || {}),
|
|
7429
|
-
...size_data
|
|
7430
|
-
};
|
|
7431
|
-
});
|
|
7432
|
-
return $9HbP8$createComponent((0, $d20eff0aadc28983$export$acb3eaade4b23afd), {
|
|
7433
|
-
get style() {
|
|
7434
|
-
return style();
|
|
7435
|
-
},
|
|
7436
|
-
get ["class"]() {
|
|
7437
|
-
return props.class;
|
|
7438
|
-
}
|
|
7439
|
-
});
|
|
7440
|
-
}
|
|
7441
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);
|
|
7442
7789
|
function $bb15dfb548a7666e$export$ee1733d9a8495996() {
|
|
7443
7790
|
return (() => {
|
|
@@ -9863,7 +10210,8 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
9863
10210
|
router_: router_,
|
|
9864
10211
|
content_results_rows_: content_results_rows_,
|
|
9865
10212
|
content_layout_options_: content_layout_options_,
|
|
9866
|
-
content_search_enabled_: content_search_enabled_
|
|
10213
|
+
content_search_enabled_: content_search_enabled_,
|
|
10214
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
9867
10215
|
}) {
|
|
9868
10216
|
const [get_sorting] = current_sorting_;
|
|
9869
10217
|
const all_products_loaded_ = $9HbP8$createSignal(false);
|
|
@@ -10142,6 +10490,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
10142
10490
|
layout_options_: layout_options_,
|
|
10143
10491
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
10144
10492
|
id_currently_querying_for_: get_search_query_,
|
|
10493
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
10145
10494
|
no_results_options_: {
|
|
10146
10495
|
selected_filters_: selected_filters_,
|
|
10147
10496
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -10587,6 +10936,7 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
|
|
|
10587
10936
|
search_sorting_open_: state_.sorting_open,
|
|
10588
10937
|
expanded_filters_: state_.expanded_filters,
|
|
10589
10938
|
content_results_rows_: state_.content_results_rows,
|
|
10939
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
10590
10940
|
router_: shared_properties.router_,
|
|
10591
10941
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
10592
10942
|
return $897bd4a76f611b38$export$d757d54550ebfb3d({
|