@depict-ai/ui 2.0.26 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ES10/index.cjs +483 -111
- package/ES10/index.d.ts +75 -45
- package/ES10/index.js +484 -112
- package/latest/index.cjs +453 -103
- package/latest/index.d.ts +75 -45
- package/latest/index.js +454 -104
- package/locales/require.js +1152 -0
- package/package.json +4 -4
- package/server/ES10/index.cjs +454 -111
- package/server/ES10/index.d.ts +75 -45
- package/server/ES10/index.js +455 -112
- package/server/latest/index.cjs +424 -103
- package/server/latest/index.d.ts +75 -45
- package/server/latest/index.js +425 -104
package/ES10/index.cjs
CHANGED
|
@@ -4,6 +4,7 @@ var $52FdA$solidjs = require("solid-js");
|
|
|
4
4
|
var $52FdA$babelruntimehelpersclassPrivateFieldSet = require("@babel/runtime/helpers/classPrivateFieldSet");
|
|
5
5
|
var $52FdA$babelruntimehelpersclassPrivateFieldGet = require("@babel/runtime/helpers/classPrivateFieldGet");
|
|
6
6
|
var $52FdA$babelruntimehelpersdefineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
7
|
+
var $52FdA$solidjsstore = require("solid-js/store");
|
|
7
8
|
require("../multi_import_deduplicator.cjs").register_es_version("ui", "ES10");
|
|
8
9
|
function $parcel$export(e, n, v, s) {
|
|
9
10
|
Object.defineProperty(e, n, {
|
|
@@ -75,7 +76,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
|
|
|
75
76
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
|
|
76
77
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
77
78
|
/*! Depict.ai search and product listing SDK */
|
|
78
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0
|
|
79
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.0";
|
|
79
80
|
const $a68b73fd7ba0853f$var$fallback_operator = "in";
|
|
80
81
|
const $a68b73fd7ba0853f$var$fallback_token = "";
|
|
81
82
|
const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
|
|
@@ -512,7 +513,7 @@ const $5401a6698b0c0658$export$6daf8749b65a1b77 = cols_at_size => {
|
|
|
512
513
|
return $5401a6698b0c0658$var$transform_elements(sorted_cols_at_size);
|
|
513
514
|
};
|
|
514
515
|
function $8edd3cf30d1fd8b4$export$a2cc176055f8f08() {
|
|
515
|
-
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.";
|
|
516
|
+
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.";
|
|
516
517
|
return (0, $52FdA$solidjsweb.isServer) ? {
|
|
517
518
|
t: "<!-- ".concat(text, " -->")
|
|
518
519
|
} : document.createComment(text);
|
|
@@ -534,12 +535,13 @@ let $e3915574cfd3466c$var$rendering_cached_placeholder_element;
|
|
|
534
535
|
function $e3915574cfd3466c$export$f33414a4df0afd3f(_ref) {
|
|
535
536
|
let {
|
|
536
537
|
product_card_template_: product_card_template_,
|
|
537
|
-
num_placeholders_: num_placeholders_
|
|
538
|
+
num_placeholders_: num_placeholders_,
|
|
539
|
+
content_blocks_: content_blocks_
|
|
538
540
|
} = _ref;
|
|
539
|
-
const [
|
|
540
|
-
let existing_num = 0;
|
|
541
|
+
const [num_to_actually_show, set_num_to_actually_show] = $52FdA$solidjs.createSignal($52FdA$solidjs.untrack(num_placeholders_));
|
|
541
542
|
if (0, $52FdA$solidjsweb.isServer)
|
|
542
543
|
// want to render simple placeholders on server, effects don't run there
|
|
544
|
+
// FIXME when adding proper SSR: also SSR content blocks
|
|
543
545
|
return $52FdA$solidjs.createMemo(() => Array.from({
|
|
544
546
|
length: num_placeholders_()
|
|
545
547
|
}).map(() => {
|
|
@@ -548,19 +550,33 @@ function $e3915574cfd3466c$export$f33414a4df0afd3f(_ref) {
|
|
|
548
550
|
if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
|
|
549
551
|
}));
|
|
550
552
|
$52FdA$solidjs.createRenderEffect(() => {
|
|
553
|
+
const existing_num = num_to_actually_show();
|
|
551
554
|
const to_add = num_placeholders_() - existing_num;
|
|
552
555
|
if (to_add <= 0) return;
|
|
553
556
|
// 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.
|
|
554
557
|
// 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.
|
|
555
558
|
// 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.
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
559
|
+
// 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
|
|
560
|
+
// Functionality should be the same
|
|
561
|
+
set_num_to_actually_show(existing_num + to_add);
|
|
562
|
+
});
|
|
563
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
|
|
564
|
+
get each() {
|
|
565
|
+
return Array.from({
|
|
566
|
+
length: num_to_actually_show()
|
|
567
|
+
});
|
|
568
|
+
},
|
|
569
|
+
children: (_item, index) => {
|
|
570
|
+
const possible_content_block = $52FdA$solidjs.createMemo(() => {
|
|
571
|
+
var _content_blocks_, _content_blocks_2;
|
|
572
|
+
return content_blocks_ === null || content_blocks_ === void 0 ? void 0 : (_content_blocks_ = content_blocks_()) === null || _content_blocks_ === void 0 ? void 0 : (_content_blocks_2 = _content_blocks_()) === null || _content_blocks_2 === void 0 ? void 0 : _content_blocks_2[index];
|
|
573
|
+
});
|
|
574
|
+
// Show content block before product card, so it's *at* that index
|
|
575
|
+
return [possible_content_block, $e3915574cfd3466c$var$Placeholder({
|
|
576
|
+
product_card_template_: product_card_template_
|
|
577
|
+
})]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
578
|
+
}
|
|
562
579
|
});
|
|
563
|
-
return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
564
580
|
}
|
|
565
581
|
/**
|
|
566
582
|
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
@@ -651,7 +667,8 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
651
667
|
merchant_: merchant_,
|
|
652
668
|
market_: market_,
|
|
653
669
|
product_card_template_: product_card_template_,
|
|
654
|
-
do_per_elements_: do_per_elements_
|
|
670
|
+
do_per_elements_: do_per_elements_,
|
|
671
|
+
content_blocks_: content_blocks_
|
|
655
672
|
} = _ref;
|
|
656
673
|
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.For), {
|
|
657
674
|
get each() {
|
|
@@ -659,6 +676,10 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
659
676
|
},
|
|
660
677
|
children: (product_id, index) => {
|
|
661
678
|
const owner = $52FdA$solidjs.getOwner();
|
|
679
|
+
const possible_content_block = $52FdA$solidjs.createMemo(() => {
|
|
680
|
+
var _content_blocks_, _content_blocks_2;
|
|
681
|
+
return content_blocks_ === null || content_blocks_ === void 0 ? void 0 : (_content_blocks_ = content_blocks_()) === null || _content_blocks_ === void 0 ? void 0 : (_content_blocks_2 = _content_blocks_()) === null || _content_blocks_2 === void 0 ? void 0 : _content_blocks_2[index()];
|
|
682
|
+
});
|
|
662
683
|
const display_accessor = $52FdA$solidjs.createMemo(prev => {
|
|
663
684
|
const new_display = displays_by_key_().get(product_id);
|
|
664
685
|
if (prev && $76012c4468a53d1f$var$deep_equal(prev, new_display))
|
|
@@ -712,7 +733,9 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
712
733
|
}
|
|
713
734
|
do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
|
|
714
735
|
});
|
|
715
|
-
return
|
|
736
|
+
return [
|
|
737
|
+
// Show content block before product card, so it's *at* that index
|
|
738
|
+
possible_content_block, product_card_resource]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
716
739
|
}
|
|
717
740
|
});
|
|
718
741
|
}
|
|
@@ -4948,7 +4971,9 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
4948
4971
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
4949
4972
|
query_base_: query_base_,
|
|
4950
4973
|
depict_api_: depict_api_,
|
|
4951
|
-
is_loading_: is_loading_
|
|
4974
|
+
is_loading_: is_loading_,
|
|
4975
|
+
content_blocks_: content_blocks_,
|
|
4976
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4952
4977
|
} = _ref;
|
|
4953
4978
|
// 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
|
|
4954
4979
|
const target_to_index_map = new Map();
|
|
@@ -4995,11 +5020,13 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
4995
5020
|
query_base_: query_base_,
|
|
4996
5021
|
depict_api_: depict_api_
|
|
4997
5022
|
});
|
|
5023
|
+
$52FdA$solidjs.createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
4998
5024
|
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
4999
5025
|
displays_by_key_: displays_by_key_,
|
|
5000
5026
|
merchant_: merchant_,
|
|
5001
5027
|
market_: market_,
|
|
5002
5028
|
product_card_template_: product_card_template_,
|
|
5029
|
+
content_blocks_: content_blocks_,
|
|
5003
5030
|
do_per_elements_: (elements, index_accessor) =>
|
|
5004
5031
|
// Adds/removes elements from the "results in viewport" intersection observer above
|
|
5005
5032
|
$52FdA$solidjs.createEffect(() => {
|
|
@@ -5021,6 +5048,363 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
5021
5048
|
})
|
|
5022
5049
|
});
|
|
5023
5050
|
}
|
|
5051
|
+
const $830518481649feb1$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div></div>`, 2),
|
|
5052
|
+
$830518481649feb1$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<style type="text/css"></style>`, 2);
|
|
5053
|
+
const $830518481649feb1$export$c500183c31c2b22e = "--spans-columns";
|
|
5054
|
+
function $830518481649feb1$export$ab6b147eec64fea5(props) {
|
|
5055
|
+
const container_class = "x" + $52FdA$solidjs.createUniqueId();
|
|
5056
|
+
const container_element_ = (() => {
|
|
5057
|
+
const _el$ = $52FdA$solidjsweb.getNextElement($830518481649feb1$var$_tmpl$);
|
|
5058
|
+
$52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(() => props.element_attributes, {
|
|
5059
|
+
"classList": {
|
|
5060
|
+
[container_class]: true
|
|
5061
|
+
}
|
|
5062
|
+
}), false, true);
|
|
5063
|
+
$52FdA$solidjsweb.insert(_el$, () => props.children);
|
|
5064
|
+
$52FdA$solidjsweb.runHydrationEvents();
|
|
5065
|
+
return _el$;
|
|
5066
|
+
})(); // Don't want this in the error boundary below, it should only be for the actual layouting
|
|
5067
|
+
return $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
|
|
5068
|
+
message_: "Failed calculating css grid layout",
|
|
5069
|
+
severity_: "error",
|
|
5070
|
+
get children() {
|
|
5071
|
+
return $830518481649feb1$export$e2f22da34aaf310a(props, container_element_, false, container_class);
|
|
5072
|
+
}
|
|
5073
|
+
});
|
|
5074
|
+
}
|
|
5075
|
+
function $830518481649feb1$export$e2f22da34aaf310a(props, container_element) {
|
|
5076
|
+
let insert_after_container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
5077
|
+
let container_class = arguments.length > 3 ? arguments[3] : undefined;
|
|
5078
|
+
if (!container_class) {
|
|
5079
|
+
// only try to add if it wasn't provided, so that we have a code path without classList when doing SSR
|
|
5080
|
+
container_class = $52FdA$depictaiutilishared.make_random_classname();
|
|
5081
|
+
container_element.classList.add(container_class);
|
|
5082
|
+
}
|
|
5083
|
+
const container_selector = ".depict .".concat(container_class); // class so ppl can have id if needed
|
|
5084
|
+
const col_styling = $52FdA$solidjs.createMemo(() => $830518481649feb1$var$generate_media_queried_declarations({
|
|
5085
|
+
container_selector_: container_selector,
|
|
5086
|
+
default_grid_spacing_text: props.grid_spacing,
|
|
5087
|
+
cols_at_size_: props.cols_at_size,
|
|
5088
|
+
override_vertical_spacing_: props.override_vertical_spacing,
|
|
5089
|
+
top_row_shortened_by_: props.top_row_shortened_by_()
|
|
5090
|
+
}));
|
|
5091
|
+
const base_styling = $52FdA$solidjs.createMemo(() => {
|
|
5092
|
+
return "".concat(container_selector, "{display:grid;}");
|
|
5093
|
+
});
|
|
5094
|
+
const get_styling = $52FdA$solidjs.createMemo(() => base_styling() + col_styling());
|
|
5095
|
+
const style_element = (() => {
|
|
5096
|
+
const _el$2 = $52FdA$solidjsweb.getNextElement($830518481649feb1$var$_tmpl$2);
|
|
5097
|
+
$52FdA$solidjsweb.insert(_el$2, get_styling);
|
|
5098
|
+
return _el$2;
|
|
5099
|
+
})(); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
|
|
5100
|
+
if (insert_after_container) container_element.after(style_element);
|
|
5101
|
+
return [container_element, style_element];
|
|
5102
|
+
}
|
|
5103
|
+
function $830518481649feb1$var$generate_media_queried_declarations(_ref) {
|
|
5104
|
+
let {
|
|
5105
|
+
container_selector_: container_selector_,
|
|
5106
|
+
default_grid_spacing_text: default_grid_spacing_text,
|
|
5107
|
+
cols_at_size_: cols_at_size_,
|
|
5108
|
+
override_vertical_spacing_: override_vertical_spacing_,
|
|
5109
|
+
top_row_shortened_by_: top_row_shortened_by_
|
|
5110
|
+
} = _ref;
|
|
5111
|
+
return cols_at_size_.map(options => {
|
|
5112
|
+
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
5113
|
+
const spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
5114
|
+
// See comment in else block below
|
|
5115
|
+
const can_use_gap = $830518481649feb1$var$can_use_gap_for_unit(spacing_to_use) && (!override_vertical_spacing_ || $830518481649feb1$var$can_use_gap_for_unit(override_vertical_spacing_));
|
|
5116
|
+
let spacing_styling;
|
|
5117
|
+
let additional_styling = ""; // outside the media query
|
|
5118
|
+
if (can_use_gap) spacing_styling = "gap:".concat(spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
|
|
5119
|
+
// 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)
|
|
5120
|
+
// 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.
|
|
5121
|
+
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
5122
|
+
// 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.
|
|
5123
|
+
const width_multiplier = "var(".concat($830518481649feb1$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
|
|
5124
|
+
const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($830518481649feb1$var$strip_percent_unit(spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
|
|
5125
|
+
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
5126
|
+
const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
|
|
5127
|
+
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($830518481649feb1$var$strip_percent_unit(spacing_to_use), ")"); // Width of the gaps
|
|
5128
|
+
const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
|
|
5129
|
+
// 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
|
|
5130
|
+
const convert_top_spacing_to_item_width_percentage = spacing => "calc(calc(100 / ".concat(this_item_width, ") * ").concat(spacing, ")"); // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
|
|
5131
|
+
spacing_styling = "column-gap:".concat(spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
|
|
5132
|
+
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
5133
|
+
additional_styling = $52FdA$depictaiutilishared.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_);
|
|
5134
|
+
}
|
|
5135
|
+
const media_query_body = "".concat(container_selector_, "{").concat(spacing_styling, "grid-template-columns:repeat(").concat(n_cols, ",minmax(0,1fr));}");
|
|
5136
|
+
return "".concat($52FdA$depictaiutilishared.layout_media_query_header(min, max), "{").concat(media_query_body, "}").concat(additional_styling);
|
|
5137
|
+
}).join("");
|
|
5138
|
+
}
|
|
5139
|
+
function $830518481649feb1$var$can_use_gap_for_unit(spacing) {
|
|
5140
|
+
const trimmed_spacing = spacing.trim();
|
|
5141
|
+
return !trimmed_spacing.includes("%");
|
|
5142
|
+
}
|
|
5143
|
+
function $830518481649feb1$var$strip_percent_unit(css_value) {
|
|
5144
|
+
return css_value.replaceAll("%", "");
|
|
5145
|
+
}
|
|
5146
|
+
function $c749e60bca5000cb$export$cb5808ba002cdeed(_ref) {
|
|
5147
|
+
let {
|
|
5148
|
+
layout_options_: layout_options_,
|
|
5149
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
5150
|
+
} = _ref;
|
|
5151
|
+
return $52FdA$solidjs.createMemo(() => {
|
|
5152
|
+
const layout_options = layout_options_();
|
|
5153
|
+
// Add grid styling that changes when filters get opened/closed
|
|
5154
|
+
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
5155
|
+
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
5156
|
+
const [num_cols_default,,,, override_cols] = row;
|
|
5157
|
+
const cloned_row = [...row];
|
|
5158
|
+
// @ts-ignore
|
|
5159
|
+
cloned_row[0] = num_cols_default - 1;
|
|
5160
|
+
if (override_cols)
|
|
5161
|
+
// @ts-ignore
|
|
5162
|
+
cloned_row[4] = {
|
|
5163
|
+
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(_ref2 => {
|
|
5164
|
+
let [row, column] = _ref2;
|
|
5165
|
+
return [row, column - 1];
|
|
5166
|
+
}))
|
|
5167
|
+
};
|
|
5168
|
+
return cloned_row;
|
|
5169
|
+
}) : when_filters_closed_cols;
|
|
5170
|
+
});
|
|
5171
|
+
}
|
|
5172
|
+
function $85fcdab554c24789$export$a79e666719b3647c(cols_at_size_) {
|
|
5173
|
+
const size_active = $52FdA$solidjs.createMemo(() => cols_at_size_().map(_ref => {
|
|
5174
|
+
let [n_cols, min_width, max_width] = _ref;
|
|
5175
|
+
const media_query = $52FdA$depictaiutilishared.layout_media_query_header(min_width, max_width).replaceAll("@media", "");
|
|
5176
|
+
const matches = $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query);
|
|
5177
|
+
return [matches, n_cols];
|
|
5178
|
+
}));
|
|
5179
|
+
const n_cols_currently_showing = $52FdA$solidjs.createMemo(() => {
|
|
5180
|
+
try {
|
|
5181
|
+
const [, n_cols_currently_showing] = size_active().find(_ref2 => {
|
|
5182
|
+
let [media_query] = _ref2;
|
|
5183
|
+
return media_query();
|
|
5184
|
+
});
|
|
5185
|
+
return n_cols_currently_showing;
|
|
5186
|
+
} catch (e) {
|
|
5187
|
+
$52FdA$depictaiutilishared.dwarn("No active size found in columnsAtSize - can't render content blocks");
|
|
5188
|
+
return null;
|
|
5189
|
+
}
|
|
5190
|
+
});
|
|
5191
|
+
return n_cols_currently_showing;
|
|
5192
|
+
}
|
|
5193
|
+
function $b8a8d61b3ec5f5ac$export$3f37af283f8fb843(props) {
|
|
5194
|
+
const style = $52FdA$solidjs.createMemo(() => {
|
|
5195
|
+
const {
|
|
5196
|
+
style: style,
|
|
5197
|
+
height: height,
|
|
5198
|
+
width: width,
|
|
5199
|
+
aspectRatio: aspectRatio
|
|
5200
|
+
} = props;
|
|
5201
|
+
const is_image = aspectRatio != undefined;
|
|
5202
|
+
const size_data = is_image ? {
|
|
5203
|
+
width: "100%",
|
|
5204
|
+
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
5205
|
+
} : {
|
|
5206
|
+
width: width,
|
|
5207
|
+
height: height
|
|
5208
|
+
};
|
|
5209
|
+
return {
|
|
5210
|
+
display: "block",
|
|
5211
|
+
...(style || {}),
|
|
5212
|
+
...size_data
|
|
5213
|
+
};
|
|
5214
|
+
});
|
|
5215
|
+
return $52FdA$solidjsweb.createComponent((0, $e3d733f899558f40$export$acb3eaade4b23afd), {
|
|
5216
|
+
get style() {
|
|
5217
|
+
return style();
|
|
5218
|
+
},
|
|
5219
|
+
get ["class"]() {
|
|
5220
|
+
return props.class;
|
|
5221
|
+
}
|
|
5222
|
+
});
|
|
5223
|
+
}
|
|
5224
|
+
const $f8f375d6245ffff2$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="content-block-wrapper"></div>`, 2);
|
|
5225
|
+
function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
|
|
5226
|
+
let {
|
|
5227
|
+
content_blocks_: incoming_content_blocks,
|
|
5228
|
+
cols_at_size_: cols_at_size_,
|
|
5229
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
5230
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
5231
|
+
} = _ref;
|
|
5232
|
+
// these are by row
|
|
5233
|
+
const [content_blocks, set_content_blocks] = $52FdA$solidjsstore.createStore([]);
|
|
5234
|
+
const n_cols_currently_showing_ = $85fcdab554c24789$export$a79e666719b3647c(cols_at_size_);
|
|
5235
|
+
const products_to_rows = products => {
|
|
5236
|
+
const cols_currently_showing = n_cols_currently_showing_();
|
|
5237
|
+
if (cols_currently_showing === null) return 0;
|
|
5238
|
+
return Math.ceil(products / cols_currently_showing);
|
|
5239
|
+
};
|
|
5240
|
+
const showing_rows = $52FdA$solidjs.createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
5241
|
+
$52FdA$solidjs.createEffect(() => {
|
|
5242
|
+
const incoming_value = incoming_content_blocks();
|
|
5243
|
+
if (!incoming_value) {
|
|
5244
|
+
set_content_blocks([]);
|
|
5245
|
+
return;
|
|
5246
|
+
}
|
|
5247
|
+
const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
|
|
5248
|
+
set_content_blocks($52FdA$solidjsstore.reconcile(capped_value));
|
|
5249
|
+
});
|
|
5250
|
+
const get_wrapped_blocks_ = $f8f375d6245ffff2$var$wrap_blocks_in_div(content_blocks, n_cols_currently_showing_);
|
|
5251
|
+
$52FdA$solidjs.createComputed(() => {
|
|
5252
|
+
// 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
|
|
5253
|
+
const top_row_block = get_wrapped_blocks_()[0];
|
|
5254
|
+
const blocks_in_top_row_taken = top_row_block === null || top_row_block === void 0 ? void 0 : top_row_block.span_columns;
|
|
5255
|
+
if (blocks_in_top_row_taken == undefined) {
|
|
5256
|
+
// Fall back to zero if no content block in top row, since then no blocks in top row are taken
|
|
5257
|
+
set_top_row_shortened_by_(0);
|
|
5258
|
+
return;
|
|
5259
|
+
}
|
|
5260
|
+
set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
|
|
5261
|
+
});
|
|
5262
|
+
|
|
5263
|
+
return $f8f375d6245ffff2$var$remap_blocks_to_index({
|
|
5264
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
5265
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
5266
|
+
});
|
|
5267
|
+
}
|
|
5268
|
+
/**
|
|
5269
|
+
* Calculate where to put each of the finished wrapped content blocks. Also limit blocks' max width.
|
|
5270
|
+
* @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
|
|
5271
|
+
*/
|
|
5272
|
+
function $f8f375d6245ffff2$var$remap_blocks_to_index(_ref2) {
|
|
5273
|
+
let {
|
|
5274
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
5275
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
5276
|
+
} = _ref2;
|
|
5277
|
+
return $52FdA$solidjs.createMemo(() => {
|
|
5278
|
+
// This computation should be quite cheap since it just moves around things into an array
|
|
5279
|
+
const content_blocks_by_index = [];
|
|
5280
|
+
const constructed_block_arrays = new WeakSet();
|
|
5281
|
+
const wrapped_blocks = get_wrapped_blocks_();
|
|
5282
|
+
const cols_showing = n_cols_currently_showing_();
|
|
5283
|
+
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
5284
|
+
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
|
|
5285
|
+
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
5286
|
+
// i = row to show at
|
|
5287
|
+
const block = wrapped_blocks[i];
|
|
5288
|
+
if (!block) continue; // Array can have holes/not defined places
|
|
5289
|
+
const index_of_first_item_in_row = i * cols_showing;
|
|
5290
|
+
const index_of_last_item_in_row = index_of_first_item_in_row + cols_showing;
|
|
5291
|
+
const {
|
|
5292
|
+
span_rows: span_rows,
|
|
5293
|
+
position: position,
|
|
5294
|
+
span_columns: span_columns
|
|
5295
|
+
} = block; // span columns is already capped in the block wrapping step (wrap_blocks_in_div)
|
|
5296
|
+
let target_index;
|
|
5297
|
+
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));
|
|
5298
|
+
// Calculate displacement of us by content blocks above us
|
|
5299
|
+
let displacement_by_added_blocks = 0;
|
|
5300
|
+
for (let j = 0; j < i; j++) {
|
|
5301
|
+
const row = displaced_products[j];
|
|
5302
|
+
if (row === undefined) continue; // there were no blocks in this row
|
|
5303
|
+
let items_in_row;
|
|
5304
|
+
if (typeof row === "number") items_in_row = row;else {
|
|
5305
|
+
items_in_row = row.filter(item => item).length;
|
|
5306
|
+
displaced_products[j] = items_in_row;
|
|
5307
|
+
}
|
|
5308
|
+
displacement_by_added_blocks += items_in_row;
|
|
5309
|
+
}
|
|
5310
|
+
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
5311
|
+
for (let j = 0; j < index_of_us_in_row; j++) {
|
|
5312
|
+
var _displaced_products$i;
|
|
5313
|
+
if ((_displaced_products$i = displaced_products[i]) !== null && _displaced_products$i !== void 0 && _displaced_products$i[j])
|
|
5314
|
+
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
5315
|
+
displacement_by_added_blocks++;
|
|
5316
|
+
}
|
|
5317
|
+
// Add block to output array at the correct index
|
|
5318
|
+
const final_target_index = target_index - displacement_by_added_blocks;
|
|
5319
|
+
const existing_block = content_blocks_by_index[final_target_index];
|
|
5320
|
+
const block_content = block.content;
|
|
5321
|
+
// 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
|
|
5322
|
+
if (existing_block) {
|
|
5323
|
+
if (constructed_block_arrays.has(existing_block))
|
|
5324
|
+
// Only push to arrays we have created to not create funky bugs when there's an array in JSX.Element
|
|
5325
|
+
existing_block.push(block_content);else {
|
|
5326
|
+
const array = [existing_block, block_content];
|
|
5327
|
+
constructed_block_arrays.add(array);
|
|
5328
|
+
content_blocks_by_index[final_target_index] = array;
|
|
5329
|
+
}
|
|
5330
|
+
} else content_blocks_by_index[final_target_index] = block_content;
|
|
5331
|
+
// Update displacement
|
|
5332
|
+
for (let j = 0; j < span_rows; j++) {
|
|
5333
|
+
var _ref3;
|
|
5334
|
+
const row = displaced_products[_ref3 = i + j] || (displaced_products[_ref3] = []);
|
|
5335
|
+
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
5336
|
+
}
|
|
5337
|
+
}
|
|
5338
|
+
return content_blocks_by_index;
|
|
5339
|
+
});
|
|
5340
|
+
}
|
|
5341
|
+
/**
|
|
5342
|
+
* 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.
|
|
5343
|
+
* Then renders the content and wraps it into a div with the correct styling.
|
|
5344
|
+
* Also caps span_columns to max available columns
|
|
5345
|
+
*/
|
|
5346
|
+
function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
5347
|
+
const get_wrapped_blocks = $52FdA$solidjs.mapArray(() => rendered_content_blocks, block => {
|
|
5348
|
+
if (!block) return;
|
|
5349
|
+
const get_span_columns = () => {
|
|
5350
|
+
var _max_span_columns;
|
|
5351
|
+
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
5352
|
+
};
|
|
5353
|
+
return $52FdA$solidjs.mergeProps(block, {
|
|
5354
|
+
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
5355
|
+
content: (() => {
|
|
5356
|
+
const _el$ = $52FdA$solidjsweb.getNextElement($f8f375d6245ffff2$var$_tmpl$);
|
|
5357
|
+
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent($f8f375d6245ffff2$var$RenderContent, {
|
|
5358
|
+
get content() {
|
|
5359
|
+
return block.content;
|
|
5360
|
+
}
|
|
5361
|
+
}));
|
|
5362
|
+
$52FdA$solidjsweb.effect(_p$ => {
|
|
5363
|
+
const _v$ = {
|
|
5364
|
+
[(0, $830518481649feb1$export$c500183c31c2b22e)]: get_span_columns()
|
|
5365
|
+
},
|
|
5366
|
+
_v$2 = "span ".concat(get_span_columns()),
|
|
5367
|
+
_v$3 = "span ".concat(block.span_rows);
|
|
5368
|
+
_p$._v$ = $52FdA$solidjsweb.style(_el$, _v$, _p$._v$);
|
|
5369
|
+
_v$2 !== _p$._v$2 && _el$.style.setProperty("grid-column", _p$._v$2 = _v$2);
|
|
5370
|
+
_v$3 !== _p$._v$3 && _el$.style.setProperty("grid-row", _p$._v$3 = _v$3);
|
|
5371
|
+
return _p$;
|
|
5372
|
+
}, {
|
|
5373
|
+
_v$: undefined,
|
|
5374
|
+
_v$2: undefined,
|
|
5375
|
+
_v$3: undefined
|
|
5376
|
+
});
|
|
5377
|
+
return _el$;
|
|
5378
|
+
})(),
|
|
5379
|
+
get span_columns() {
|
|
5380
|
+
// Cap max width of block to the number of columns available, for everyone downstream
|
|
5381
|
+
return get_span_columns();
|
|
5382
|
+
}
|
|
5383
|
+
});
|
|
5384
|
+
});
|
|
5385
|
+
return get_wrapped_blocks;
|
|
5386
|
+
}
|
|
5387
|
+
/**
|
|
5388
|
+
* 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.
|
|
5389
|
+
*/
|
|
5390
|
+
function $f8f375d6245ffff2$var$RenderContent(props) {
|
|
5391
|
+
const [resource] = $52FdA$solidjs.createResource(() => props.content,
|
|
5392
|
+
// Could be reactive
|
|
5393
|
+
fn => fn());
|
|
5394
|
+
$52FdA$solidjs.createEffect(() => {
|
|
5395
|
+
if (resource.error) console.error("Error in content block rendering", resource.error);
|
|
5396
|
+
});
|
|
5397
|
+
// 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)
|
|
5398
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
|
|
5399
|
+
get fallback() {
|
|
5400
|
+
return $52FdA$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
|
|
5401
|
+
width: "100%",
|
|
5402
|
+
height: "max(100%, 400px)"
|
|
5403
|
+
});
|
|
5404
|
+
},
|
|
5405
|
+
children: resource
|
|
5406
|
+
});
|
|
5407
|
+
}
|
|
5024
5408
|
const $484eec37514a982e$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="PLP-results"><!#><!/><!#><!/></div>`, 6);
|
|
5025
5409
|
function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
5026
5410
|
let {
|
|
@@ -5037,7 +5421,8 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
5037
5421
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
5038
5422
|
product_card_template_: product_card_template_,
|
|
5039
5423
|
layout_options_: layout_options_,
|
|
5040
|
-
id_currently_querying_for_: id_currently_querying_for_
|
|
5424
|
+
id_currently_querying_for_: id_currently_querying_for_,
|
|
5425
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
5041
5426
|
} = _ref;
|
|
5042
5427
|
// 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
|
|
5043
5428
|
const is_loading_ = $52FdA$solidjs.createMemo(() => plp_results_.loading || query_base_.loading);
|
|
@@ -5086,24 +5471,37 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
5086
5471
|
let is_just_after_plp_results_update = false;
|
|
5087
5472
|
let fallback_is_alive = false;
|
|
5088
5473
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $52FdA$solidjs.createSignal(true);
|
|
5474
|
+
const [top_row_shortened_by_, set_top_row_shortened_by_] = $52FdA$solidjs.createSignal(0);
|
|
5475
|
+
const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $52FdA$solidjs.createSignal(false);
|
|
5476
|
+
const [number_loaded_displays, set_number_loaded_displays_] = $52FdA$solidjs.createSignal(0);
|
|
5477
|
+
const modified_cols_at_size = $c749e60bca5000cb$export$cb5808ba002cdeed({
|
|
5478
|
+
layout_options_: layout_options_,
|
|
5479
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
5480
|
+
});
|
|
5481
|
+
const num_placeholders_ = $52FdA$solidjs.createMemo(() => {
|
|
5482
|
+
var _get_scroll_restorati, _get_scroll_restorati2;
|
|
5483
|
+
// 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
|
|
5484
|
+
return (0, $da887c42f8e8847a$export$6c9030e511152266) + ((_get_scroll_restorati = (_get_scroll_restorati2 = get_scroll_restoration_data().find(_ref2 => {
|
|
5485
|
+
let {
|
|
5486
|
+
for_id: for_id
|
|
5487
|
+
} = _ref2;
|
|
5488
|
+
return for_id === id_currently_querying_for_();
|
|
5489
|
+
})) === null || _get_scroll_restorati2 === void 0 ? void 0 : _get_scroll_restorati2.min_results_loaded) !== null && _get_scroll_restorati !== void 0 ? _get_scroll_restorati : min_products_to_fetch_);
|
|
5490
|
+
});
|
|
5491
|
+
const number_of_items_shown_ = $52FdA$solidjs.createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
5492
|
+
const doesnt_have_content_blocks = $52FdA$solidjs.createMemo(() => !content_blocks_by_row_());
|
|
5493
|
+
const content_blocks_ = $52FdA$solidjs.createMemo(() => doesnt_have_content_blocks() ? () => [] : $f8f375d6245ffff2$export$791ef57e62e21c3f({
|
|
5494
|
+
content_blocks_: content_blocks_by_row_,
|
|
5495
|
+
cols_at_size_: modified_cols_at_size,
|
|
5496
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
5497
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
5498
|
+
}));
|
|
5089
5499
|
const rendered_placeholders = $52FdA$solidjs.createMemo(() => get_should_have_placeholders_rendered() ? $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
5500
|
+
content_blocks_: content_blocks_,
|
|
5090
5501
|
product_card_template_: product_card_template_,
|
|
5091
|
-
num_placeholders_:
|
|
5092
|
-
var _get_scroll_restorati, _get_scroll_restorati2;
|
|
5093
|
-
// 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
|
|
5094
|
-
return (0, $da887c42f8e8847a$export$6c9030e511152266) + ((_get_scroll_restorati = (_get_scroll_restorati2 = get_scroll_restoration_data().find(_ref2 => {
|
|
5095
|
-
let {
|
|
5096
|
-
for_id: for_id
|
|
5097
|
-
} = _ref2;
|
|
5098
|
-
return for_id === id_currently_querying_for_();
|
|
5099
|
-
})) === null || _get_scroll_restorati2 === void 0 ? void 0 : _get_scroll_restorati2.min_results_loaded) !== null && _get_scroll_restorati !== void 0 ? _get_scroll_restorati : min_products_to_fetch_);
|
|
5100
|
-
})
|
|
5502
|
+
num_placeholders_: num_placeholders_
|
|
5101
5503
|
}) : undefined);
|
|
5102
5504
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $52FdA$solidjs.createSignal(false);
|
|
5103
|
-
const modified_cols_at_size = $484eec37514a982e$var$make_modified_cols_at_size({
|
|
5104
|
-
layout_options_: layout_options_,
|
|
5105
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
5106
|
-
});
|
|
5107
5505
|
const block_suspense_if_needed = () => {
|
|
5108
5506
|
if (!is_just_after_plp_results_update) return;
|
|
5109
5507
|
is_just_after_plp_results_update = false;
|
|
@@ -5136,6 +5534,8 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
5136
5534
|
return (() => {
|
|
5137
5535
|
fallback_is_alive = true;
|
|
5138
5536
|
$52FdA$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
5537
|
+
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
5538
|
+
$52FdA$solidjs.onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
5139
5539
|
return $52FdA$solidjs.createMemo(() => {
|
|
5140
5540
|
// 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
|
|
5141
5541
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -5160,37 +5560,64 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
5160
5560
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
5161
5561
|
query_base_: query_base_,
|
|
5162
5562
|
depict_api_: depict_api_,
|
|
5163
|
-
is_loading_: is_loading_
|
|
5563
|
+
is_loading_: is_loading_,
|
|
5564
|
+
content_blocks_: content_blocks_,
|
|
5565
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
5164
5566
|
});
|
|
5165
5567
|
$52FdA$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
5166
5568
|
return suspense_contents;
|
|
5167
5569
|
})();
|
|
5168
5570
|
}
|
|
5169
5571
|
});
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5572
|
+
/* 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 */
|
|
5573
|
+
const listing_contents = $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
5574
|
+
get when() {
|
|
5575
|
+
return !is_loading_();
|
|
5173
5576
|
},
|
|
5174
|
-
get
|
|
5175
|
-
return
|
|
5577
|
+
get fallback() {
|
|
5578
|
+
return rendered_placeholders();
|
|
5176
5579
|
},
|
|
5177
|
-
|
|
5178
|
-
|
|
5580
|
+
children: product_cards_when_data
|
|
5581
|
+
});
|
|
5582
|
+
return [$52FdA$solidjsweb.memo((0, $8edd3cf30d1fd8b4$export$a2cc176055f8f08)), $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
5583
|
+
get when() {
|
|
5584
|
+
return doesnt_have_content_blocks();
|
|
5179
5585
|
},
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5586
|
+
get fallback() {
|
|
5587
|
+
return $52FdA$solidjsweb.createComponent((0, $830518481649feb1$export$ab6b147eec64fea5), {
|
|
5588
|
+
get cols_at_size() {
|
|
5589
|
+
return modified_cols_at_size();
|
|
5590
|
+
},
|
|
5591
|
+
get override_vertical_spacing() {
|
|
5592
|
+
return layout_options_().override_vertical_spacing;
|
|
5593
|
+
},
|
|
5594
|
+
get grid_spacing() {
|
|
5595
|
+
return layout_options_().grid_spacing;
|
|
5596
|
+
},
|
|
5597
|
+
element_attributes: {
|
|
5598
|
+
class: "cards css-grid"
|
|
5599
|
+
},
|
|
5600
|
+
top_row_shortened_by_: top_row_shortened_by_,
|
|
5601
|
+
children: listing_contents
|
|
5602
|
+
});
|
|
5184
5603
|
},
|
|
5185
5604
|
get children() {
|
|
5186
|
-
return $52FdA$solidjsweb.createComponent((0, $
|
|
5187
|
-
get
|
|
5188
|
-
return
|
|
5605
|
+
return $52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
|
|
5606
|
+
get cols_at_size() {
|
|
5607
|
+
return modified_cols_at_size();
|
|
5608
|
+
},
|
|
5609
|
+
get override_vertical_spacing() {
|
|
5610
|
+
return layout_options_().override_vertical_spacing;
|
|
5189
5611
|
},
|
|
5190
|
-
get
|
|
5191
|
-
return
|
|
5612
|
+
get grid_spacing() {
|
|
5613
|
+
return layout_options_().grid_spacing;
|
|
5192
5614
|
},
|
|
5193
|
-
|
|
5615
|
+
rows: "all",
|
|
5616
|
+
layout: "grid",
|
|
5617
|
+
element_attributes: {
|
|
5618
|
+
class: "cards"
|
|
5619
|
+
},
|
|
5620
|
+
children: listing_contents
|
|
5194
5621
|
});
|
|
5195
5622
|
}
|
|
5196
5623
|
})];
|
|
@@ -5203,36 +5630,6 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
5203
5630
|
return _el$;
|
|
5204
5631
|
})();
|
|
5205
5632
|
}
|
|
5206
|
-
/**
|
|
5207
|
-
* Changes cols_at_size depending on if filters are open or not so one card less is shown when the filters are open
|
|
5208
|
-
* This function is special to the actual PLPResults.
|
|
5209
|
-
*/
|
|
5210
|
-
function $484eec37514a982e$var$make_modified_cols_at_size(_ref3) {
|
|
5211
|
-
let {
|
|
5212
|
-
layout_options_: layout_options_,
|
|
5213
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
5214
|
-
} = _ref3;
|
|
5215
|
-
return $52FdA$solidjs.createMemo(() => {
|
|
5216
|
-
const layout_options = layout_options_();
|
|
5217
|
-
// Add grid styling that changes when filters get opened/closed
|
|
5218
|
-
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
5219
|
-
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
5220
|
-
const [num_cols_default,,,, override_cols] = row;
|
|
5221
|
-
const cloned_row = [...row];
|
|
5222
|
-
// @ts-ignore
|
|
5223
|
-
cloned_row[0] = num_cols_default - 1;
|
|
5224
|
-
if (override_cols)
|
|
5225
|
-
// @ts-ignore
|
|
5226
|
-
cloned_row[4] = {
|
|
5227
|
-
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(_ref4 => {
|
|
5228
|
-
let [row, column] = _ref4;
|
|
5229
|
-
return [row, column - 1];
|
|
5230
|
-
}))
|
|
5231
|
-
};
|
|
5232
|
-
return cloned_row;
|
|
5233
|
-
}) : when_filters_closed_cols;
|
|
5234
|
-
});
|
|
5235
|
-
}
|
|
5236
5633
|
const $3bd211c857f81dfd$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="sorting-attributes"></div>`, 2),
|
|
5237
5634
|
$3bd211c857f81dfd$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="sorting-direction"></div>`, 2),
|
|
5238
5635
|
$3bd211c857f81dfd$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div><div class="input-row"><input type="radio"><span class="custom-indicator"></span><!#><!/></div></div>`, 9),
|
|
@@ -6877,7 +7274,8 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
6877
7274
|
product_card_template_: product_card_template_,
|
|
6878
7275
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
6879
7276
|
sorting_query_param_: sorting_query_param_,
|
|
6880
|
-
filter_query_param_prefix_: filter_query_param_prefix_
|
|
7277
|
+
filter_query_param_prefix_: filter_query_param_prefix_,
|
|
7278
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
6881
7279
|
} = _ref;
|
|
6882
7280
|
let results_for;
|
|
6883
7281
|
let only_show_filters_opener_;
|
|
@@ -7197,6 +7595,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
7197
7595
|
product_card_template_: product_card_template_,
|
|
7198
7596
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
7199
7597
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
7598
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
7200
7599
|
id_currently_querying_for_: query_id_,
|
|
7201
7600
|
no_results_options_: {
|
|
7202
7601
|
selected_filters_: selected_filters_,
|
|
@@ -7813,6 +8212,7 @@ function $9cbefc32b9dab36d$export$e2bf8ce7779e827e(props) {
|
|
|
7813
8212
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
7814
8213
|
selected_filters_: selected_filters_,
|
|
7815
8214
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
8215
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
7816
8216
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
7817
8217
|
layout_options_: $52FdA$solidjs.createMemo(() => ({
|
|
7818
8218
|
cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
|
|
@@ -8069,37 +8469,6 @@ async function $822f2c95a96c3ec8$var$download_categories(tenant, market, type) {
|
|
|
8069
8469
|
return [];
|
|
8070
8470
|
}
|
|
8071
8471
|
}
|
|
8072
|
-
function $b8a8d61b3ec5f5ac$export$3f37af283f8fb843(props) {
|
|
8073
|
-
const style = $52FdA$solidjs.createMemo(() => {
|
|
8074
|
-
const {
|
|
8075
|
-
style: style,
|
|
8076
|
-
height: height,
|
|
8077
|
-
width: width,
|
|
8078
|
-
aspectRatio: aspectRatio
|
|
8079
|
-
} = props;
|
|
8080
|
-
const is_image = aspectRatio != undefined;
|
|
8081
|
-
const size_data = is_image ? {
|
|
8082
|
-
width: "100%",
|
|
8083
|
-
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
8084
|
-
} : {
|
|
8085
|
-
width: width,
|
|
8086
|
-
height: height
|
|
8087
|
-
};
|
|
8088
|
-
return {
|
|
8089
|
-
display: "block",
|
|
8090
|
-
...(style || {}),
|
|
8091
|
-
...size_data
|
|
8092
|
-
};
|
|
8093
|
-
});
|
|
8094
|
-
return $52FdA$solidjsweb.createComponent((0, $e3d733f899558f40$export$acb3eaade4b23afd), {
|
|
8095
|
-
get style() {
|
|
8096
|
-
return style();
|
|
8097
|
-
},
|
|
8098
|
-
get ["class"]() {
|
|
8099
|
-
return props.class;
|
|
8100
|
-
}
|
|
8101
|
-
});
|
|
8102
|
-
}
|
|
8103
8472
|
const $c0cf6af094336798$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.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);
|
|
8104
8473
|
function $c0cf6af094336798$export$ee1733d9a8495996() {
|
|
8105
8474
|
return (() => {
|
|
@@ -10653,7 +11022,8 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
10653
11022
|
router_: router_,
|
|
10654
11023
|
content_results_rows_: content_results_rows_,
|
|
10655
11024
|
content_layout_options_: content_layout_options_,
|
|
10656
|
-
content_search_enabled_: content_search_enabled_
|
|
11025
|
+
content_search_enabled_: content_search_enabled_,
|
|
11026
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
10657
11027
|
} = _ref;
|
|
10658
11028
|
const [get_sorting] = current_sorting_;
|
|
10659
11029
|
const all_products_loaded_ = $52FdA$solidjs.createSignal(false);
|
|
@@ -10954,6 +11324,7 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
10954
11324
|
layout_options_: layout_options_,
|
|
10955
11325
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
10956
11326
|
id_currently_querying_for_: get_search_query_,
|
|
11327
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
10957
11328
|
no_results_options_: {
|
|
10958
11329
|
selected_filters_: selected_filters_,
|
|
10959
11330
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -11487,6 +11858,7 @@ function $ddd39c5f36f49703$export$f2dc7e4e4aa11abb(props) {
|
|
|
11487
11858
|
search_sorting_open_: state_.sorting_open,
|
|
11488
11859
|
expanded_filters_: state_.expanded_filters,
|
|
11489
11860
|
content_results_rows_: state_.content_results_rows,
|
|
11861
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
11490
11862
|
router_: shared_properties.router_,
|
|
11491
11863
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
11492
11864
|
return $3001ad378baf39dc$export$d757d54550ebfb3d({
|