@depict-ai/ui 2.0.25 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ES10/index.cjs +489 -114
- package/ES10/index.d.ts +75 -45
- package/ES10/index.js +490 -115
- package/latest/index.cjs +458 -106
- package/latest/index.d.ts +75 -45
- package/latest/index.js +459 -107
- package/locales/require.js +1152 -0
- package/package.json +4 -4
- package/server/ES10/index.cjs +460 -114
- package/server/ES10/index.d.ts +75 -45
- package/server/ES10/index.js +461 -115
- package/server/latest/index.cjs +429 -106
- package/server/latest/index.d.ts +75 -45
- package/server/latest/index.js +430 -107
package/server/ES10/index.cjs
CHANGED
|
@@ -4,6 +4,7 @@ var $3hooq$solidjs = require("solid-js");
|
|
|
4
4
|
var $3hooq$babelruntimehelpersclassPrivateFieldSet = require("@babel/runtime/helpers/classPrivateFieldSet");
|
|
5
5
|
var $3hooq$babelruntimehelpersclassPrivateFieldGet = require("@babel/runtime/helpers/classPrivateFieldGet");
|
|
6
6
|
var $3hooq$babelruntimehelpersdefineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
7
|
+
var $3hooq$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_";
|
|
@@ -481,7 +482,7 @@ const $5401a6698b0c0658$export$6daf8749b65a1b77 = cols_at_size => {
|
|
|
481
482
|
return $5401a6698b0c0658$var$transform_elements(sorted_cols_at_size);
|
|
482
483
|
};
|
|
483
484
|
function $8edd3cf30d1fd8b4$export$a2cc176055f8f08() {
|
|
484
|
-
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.";
|
|
485
|
+
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.";
|
|
485
486
|
return (0, $3hooq$solidjsweb.isServer) ? {
|
|
486
487
|
t: "<!-- ".concat(text, " -->")
|
|
487
488
|
} : document.createComment(text);
|
|
@@ -503,12 +504,13 @@ let $e3915574cfd3466c$var$rendering_cached_placeholder_element;
|
|
|
503
504
|
function $e3915574cfd3466c$export$f33414a4df0afd3f(_ref) {
|
|
504
505
|
let {
|
|
505
506
|
product_card_template_: product_card_template_,
|
|
506
|
-
num_placeholders_: num_placeholders_
|
|
507
|
+
num_placeholders_: num_placeholders_,
|
|
508
|
+
content_blocks_: content_blocks_
|
|
507
509
|
} = _ref;
|
|
508
|
-
const [
|
|
509
|
-
let existing_num = 0;
|
|
510
|
+
const [num_to_actually_show, set_num_to_actually_show] = $3hooq$solidjs.createSignal($3hooq$solidjs.untrack(num_placeholders_));
|
|
510
511
|
if (0, $3hooq$solidjsweb.isServer)
|
|
511
512
|
// want to render simple placeholders on server, effects don't run there
|
|
513
|
+
// FIXME when adding proper SSR: also SSR content blocks
|
|
512
514
|
return $3hooq$solidjs.createMemo(() => Array.from({
|
|
513
515
|
length: num_placeholders_()
|
|
514
516
|
}).map(() => {
|
|
@@ -517,19 +519,33 @@ function $e3915574cfd3466c$export$f33414a4df0afd3f(_ref) {
|
|
|
517
519
|
if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
|
|
518
520
|
}));
|
|
519
521
|
$3hooq$solidjs.createRenderEffect(() => {
|
|
522
|
+
const existing_num = num_to_actually_show();
|
|
520
523
|
const to_add = num_placeholders_() - existing_num;
|
|
521
524
|
if (to_add <= 0) return;
|
|
522
525
|
// 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.
|
|
523
526
|
// 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.
|
|
524
527
|
// 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.
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
528
|
+
// 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
|
|
529
|
+
// Functionality should be the same
|
|
530
|
+
set_num_to_actually_show(existing_num + to_add);
|
|
531
|
+
});
|
|
532
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Index), {
|
|
533
|
+
get each() {
|
|
534
|
+
return Array.from({
|
|
535
|
+
length: num_to_actually_show()
|
|
536
|
+
});
|
|
537
|
+
},
|
|
538
|
+
children: (_item, index) => {
|
|
539
|
+
const possible_content_block = $3hooq$solidjs.createMemo(() => {
|
|
540
|
+
var _content_blocks_, _content_blocks_2;
|
|
541
|
+
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];
|
|
542
|
+
});
|
|
543
|
+
// Show content block before product card, so it's *at* that index
|
|
544
|
+
return [possible_content_block, $e3915574cfd3466c$var$Placeholder({
|
|
545
|
+
product_card_template_: product_card_template_
|
|
546
|
+
})]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
547
|
+
}
|
|
531
548
|
});
|
|
532
|
-
return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
533
549
|
}
|
|
534
550
|
/**
|
|
535
551
|
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
@@ -620,7 +636,8 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
620
636
|
merchant_: merchant_,
|
|
621
637
|
market_: market_,
|
|
622
638
|
product_card_template_: product_card_template_,
|
|
623
|
-
do_per_elements_: do_per_elements_
|
|
639
|
+
do_per_elements_: do_per_elements_,
|
|
640
|
+
content_blocks_: content_blocks_
|
|
624
641
|
} = _ref;
|
|
625
642
|
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.For), {
|
|
626
643
|
get each() {
|
|
@@ -628,6 +645,10 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
628
645
|
},
|
|
629
646
|
children: (product_id, index) => {
|
|
630
647
|
const owner = $3hooq$solidjs.getOwner();
|
|
648
|
+
const possible_content_block = $3hooq$solidjs.createMemo(() => {
|
|
649
|
+
var _content_blocks_, _content_blocks_2;
|
|
650
|
+
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()];
|
|
651
|
+
});
|
|
631
652
|
const display_accessor = $3hooq$solidjs.createMemo(prev => {
|
|
632
653
|
const new_display = displays_by_key_().get(product_id);
|
|
633
654
|
if (prev && $76012c4468a53d1f$var$deep_equal(prev, new_display))
|
|
@@ -681,7 +702,9 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
681
702
|
}
|
|
682
703
|
do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
|
|
683
704
|
});
|
|
684
|
-
return
|
|
705
|
+
return [
|
|
706
|
+
// Show content block before product card, so it's *at* that index
|
|
707
|
+
possible_content_block, product_card_resource]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
685
708
|
}
|
|
686
709
|
});
|
|
687
710
|
}
|
|
@@ -3282,11 +3305,14 @@ function $cfcd56242923775d$var$proxy_push_state(function_name, thing) {
|
|
|
3282
3305
|
thing[function_name] = new Proxy(thing[function_name], {
|
|
3283
3306
|
apply(target, this_arg, arg_list) {
|
|
3284
3307
|
try {
|
|
3285
|
-
|
|
3308
|
+
const old_state = history.state;
|
|
3309
|
+
if (typeof old_state == "object" && old_state !== null) {
|
|
3310
|
+
var _arg_list$;
|
|
3311
|
+
// This effectively disallows the user from passing in a string, number, null or undefined
|
|
3312
|
+
const intended_new_value_as_obj = typeof arg_list[0] === "object" ? (_arg_list$ = arg_list[0]) !== null && _arg_list$ !== void 0 ? _arg_list$ : {} : {};
|
|
3286
3313
|
const cloned_object = {
|
|
3287
|
-
...
|
|
3314
|
+
...intended_new_value_as_obj
|
|
3288
3315
|
};
|
|
3289
|
-
const old_state = history.state;
|
|
3290
3316
|
for (const key in old_state) {
|
|
3291
3317
|
if (!$cfcd56242923775d$var$starts_with_any_prefix(key)) continue;
|
|
3292
3318
|
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
@@ -4032,7 +4058,9 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
4032
4058
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
4033
4059
|
query_base_: query_base_,
|
|
4034
4060
|
depict_api_: depict_api_,
|
|
4035
|
-
is_loading_: is_loading_
|
|
4061
|
+
is_loading_: is_loading_,
|
|
4062
|
+
content_blocks_: content_blocks_,
|
|
4063
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4036
4064
|
} = _ref;
|
|
4037
4065
|
// 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
|
|
4038
4066
|
const target_to_index_map = new Map();
|
|
@@ -4079,11 +4107,13 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
4079
4107
|
query_base_: query_base_,
|
|
4080
4108
|
depict_api_: depict_api_
|
|
4081
4109
|
});
|
|
4110
|
+
$3hooq$solidjs.createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
4082
4111
|
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
4083
4112
|
displays_by_key_: displays_by_key_,
|
|
4084
4113
|
merchant_: merchant_,
|
|
4085
4114
|
market_: market_,
|
|
4086
4115
|
product_card_template_: product_card_template_,
|
|
4116
|
+
content_blocks_: content_blocks_,
|
|
4087
4117
|
do_per_elements_: (elements, index_accessor) =>
|
|
4088
4118
|
// Adds/removes elements from the "results in viewport" intersection observer above
|
|
4089
4119
|
$3hooq$solidjs.createEffect(() => {
|
|
@@ -4105,6 +4135,334 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
4105
4135
|
})
|
|
4106
4136
|
});
|
|
4107
4137
|
}
|
|
4138
|
+
const $830518481649feb1$var$_tmpl$ = ["<style", ' type="text/css">', "</style>"];
|
|
4139
|
+
const $830518481649feb1$export$c500183c31c2b22e = "--spans-columns";
|
|
4140
|
+
function $830518481649feb1$export$ab6b147eec64fea5(props) {
|
|
4141
|
+
const container_class = "x" + $3hooq$solidjs.createUniqueId();
|
|
4142
|
+
const container_element_ = $3hooq$solidjsweb.ssrElement("div", () => ({
|
|
4143
|
+
...props.element_attributes,
|
|
4144
|
+
"classList": {
|
|
4145
|
+
[container_class]: true
|
|
4146
|
+
}
|
|
4147
|
+
}), () => $3hooq$solidjsweb.escape(props.children), true); // Don't want this in the error boundary below, it should only be for the actual layouting
|
|
4148
|
+
return $3hooq$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
|
|
4149
|
+
message_: "Failed calculating css grid layout",
|
|
4150
|
+
severity_: "error",
|
|
4151
|
+
get children() {
|
|
4152
|
+
return $830518481649feb1$export$e2f22da34aaf310a(props, container_element_, false, container_class);
|
|
4153
|
+
}
|
|
4154
|
+
});
|
|
4155
|
+
}
|
|
4156
|
+
function $830518481649feb1$export$e2f22da34aaf310a(props, container_element) {
|
|
4157
|
+
let insert_after_container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4158
|
+
let container_class = arguments.length > 3 ? arguments[3] : undefined;
|
|
4159
|
+
if (!container_class) {
|
|
4160
|
+
// only try to add if it wasn't provided, so that we have a code path without classList when doing SSR
|
|
4161
|
+
container_class = $3hooq$depictaiutilishared.make_random_classname();
|
|
4162
|
+
container_element.classList.add(container_class);
|
|
4163
|
+
}
|
|
4164
|
+
const container_selector = ".depict .".concat(container_class); // class so ppl can have id if needed
|
|
4165
|
+
const col_styling = $3hooq$solidjs.createMemo(() => $830518481649feb1$var$generate_media_queried_declarations({
|
|
4166
|
+
container_selector_: container_selector,
|
|
4167
|
+
default_grid_spacing_text: props.grid_spacing,
|
|
4168
|
+
cols_at_size_: props.cols_at_size,
|
|
4169
|
+
override_vertical_spacing_: props.override_vertical_spacing,
|
|
4170
|
+
top_row_shortened_by_: props.top_row_shortened_by_()
|
|
4171
|
+
}));
|
|
4172
|
+
const base_styling = $3hooq$solidjs.createMemo(() => {
|
|
4173
|
+
return "".concat(container_selector, "{display:grid;}");
|
|
4174
|
+
});
|
|
4175
|
+
const get_styling = $3hooq$solidjs.createMemo(() => base_styling() + col_styling());
|
|
4176
|
+
const style_element = $3hooq$solidjsweb.ssr($830518481649feb1$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), get_styling); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
|
|
4177
|
+
if (insert_after_container) container_element.after(style_element);
|
|
4178
|
+
return [container_element, style_element];
|
|
4179
|
+
}
|
|
4180
|
+
function $830518481649feb1$var$generate_media_queried_declarations(_ref) {
|
|
4181
|
+
let {
|
|
4182
|
+
container_selector_: container_selector_,
|
|
4183
|
+
default_grid_spacing_text: default_grid_spacing_text,
|
|
4184
|
+
cols_at_size_: cols_at_size_,
|
|
4185
|
+
override_vertical_spacing_: override_vertical_spacing_,
|
|
4186
|
+
top_row_shortened_by_: top_row_shortened_by_
|
|
4187
|
+
} = _ref;
|
|
4188
|
+
return cols_at_size_.map(options => {
|
|
4189
|
+
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
4190
|
+
const spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
4191
|
+
// See comment in else block below
|
|
4192
|
+
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_));
|
|
4193
|
+
let spacing_styling;
|
|
4194
|
+
let additional_styling = ""; // outside the media query
|
|
4195
|
+
if (can_use_gap) spacing_styling = "gap:".concat(spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
|
|
4196
|
+
// 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)
|
|
4197
|
+
// 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.
|
|
4198
|
+
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
4199
|
+
// 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.
|
|
4200
|
+
const width_multiplier = "var(".concat($830518481649feb1$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
|
|
4201
|
+
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
|
|
4202
|
+
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
4203
|
+
const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
|
|
4204
|
+
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($830518481649feb1$var$strip_percent_unit(spacing_to_use), ")"); // Width of the gaps
|
|
4205
|
+
const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
|
|
4206
|
+
// 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
|
|
4207
|
+
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)
|
|
4208
|
+
spacing_styling = "column-gap:".concat(spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
|
|
4209
|
+
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
4210
|
+
additional_styling = $3hooq$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_);
|
|
4211
|
+
}
|
|
4212
|
+
const media_query_body = "".concat(container_selector_, "{").concat(spacing_styling, "grid-template-columns:repeat(").concat(n_cols, ",minmax(0,1fr));}");
|
|
4213
|
+
return "".concat($3hooq$depictaiutilishared.layout_media_query_header(min, max), "{").concat(media_query_body, "}").concat(additional_styling);
|
|
4214
|
+
}).join("");
|
|
4215
|
+
}
|
|
4216
|
+
function $830518481649feb1$var$can_use_gap_for_unit(spacing) {
|
|
4217
|
+
const trimmed_spacing = spacing.trim();
|
|
4218
|
+
return !trimmed_spacing.includes("%");
|
|
4219
|
+
}
|
|
4220
|
+
function $830518481649feb1$var$strip_percent_unit(css_value) {
|
|
4221
|
+
return css_value.replaceAll("%", "");
|
|
4222
|
+
}
|
|
4223
|
+
function $c749e60bca5000cb$export$cb5808ba002cdeed(_ref) {
|
|
4224
|
+
let {
|
|
4225
|
+
layout_options_: layout_options_,
|
|
4226
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
4227
|
+
} = _ref;
|
|
4228
|
+
return $3hooq$solidjs.createMemo(() => {
|
|
4229
|
+
const layout_options = layout_options_();
|
|
4230
|
+
// Add grid styling that changes when filters get opened/closed
|
|
4231
|
+
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
4232
|
+
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
4233
|
+
const [num_cols_default,,,, override_cols] = row;
|
|
4234
|
+
const cloned_row = [...row];
|
|
4235
|
+
// @ts-ignore
|
|
4236
|
+
cloned_row[0] = num_cols_default - 1;
|
|
4237
|
+
if (override_cols)
|
|
4238
|
+
// @ts-ignore
|
|
4239
|
+
cloned_row[4] = {
|
|
4240
|
+
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(_ref2 => {
|
|
4241
|
+
let [row, column] = _ref2;
|
|
4242
|
+
return [row, column - 1];
|
|
4243
|
+
}))
|
|
4244
|
+
};
|
|
4245
|
+
return cloned_row;
|
|
4246
|
+
}) : when_filters_closed_cols;
|
|
4247
|
+
});
|
|
4248
|
+
}
|
|
4249
|
+
function $85fcdab554c24789$export$a79e666719b3647c(cols_at_size_) {
|
|
4250
|
+
const size_active = $3hooq$solidjs.createMemo(() => cols_at_size_().map(_ref => {
|
|
4251
|
+
let [n_cols, min_width, max_width] = _ref;
|
|
4252
|
+
const media_query = $3hooq$depictaiutilishared.layout_media_query_header(min_width, max_width).replaceAll("@media", "");
|
|
4253
|
+
const matches = $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query);
|
|
4254
|
+
return [matches, n_cols];
|
|
4255
|
+
}));
|
|
4256
|
+
const n_cols_currently_showing = $3hooq$solidjs.createMemo(() => {
|
|
4257
|
+
try {
|
|
4258
|
+
const [, n_cols_currently_showing] = size_active().find(_ref2 => {
|
|
4259
|
+
let [media_query] = _ref2;
|
|
4260
|
+
return media_query();
|
|
4261
|
+
});
|
|
4262
|
+
return n_cols_currently_showing;
|
|
4263
|
+
} catch (e) {
|
|
4264
|
+
$3hooq$depictaiutilishared.dwarn("No active size found in columnsAtSize - can't render content blocks");
|
|
4265
|
+
return null;
|
|
4266
|
+
}
|
|
4267
|
+
});
|
|
4268
|
+
return n_cols_currently_showing;
|
|
4269
|
+
}
|
|
4270
|
+
function $b8a8d61b3ec5f5ac$export$3f37af283f8fb843(props) {
|
|
4271
|
+
const style = $3hooq$solidjs.createMemo(() => {
|
|
4272
|
+
const {
|
|
4273
|
+
style: style,
|
|
4274
|
+
height: height,
|
|
4275
|
+
width: width,
|
|
4276
|
+
aspectRatio: aspectRatio
|
|
4277
|
+
} = props;
|
|
4278
|
+
const is_image = aspectRatio != undefined;
|
|
4279
|
+
const size_data = is_image ? {
|
|
4280
|
+
width: "100%",
|
|
4281
|
+
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
4282
|
+
} : {
|
|
4283
|
+
width: width,
|
|
4284
|
+
height: height
|
|
4285
|
+
};
|
|
4286
|
+
return {
|
|
4287
|
+
display: "block",
|
|
4288
|
+
...(style || {}),
|
|
4289
|
+
...size_data
|
|
4290
|
+
};
|
|
4291
|
+
});
|
|
4292
|
+
return $3hooq$solidjsweb.createComponent((0, $e3d733f899558f40$export$acb3eaade4b23afd), {
|
|
4293
|
+
get style() {
|
|
4294
|
+
return style();
|
|
4295
|
+
},
|
|
4296
|
+
get ["class"]() {
|
|
4297
|
+
return props.class;
|
|
4298
|
+
}
|
|
4299
|
+
});
|
|
4300
|
+
}
|
|
4301
|
+
const $f8f375d6245ffff2$var$_tmpl$ = ["<div", ' class="content-block-wrapper" style="', '">', "</div>"];
|
|
4302
|
+
function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
|
|
4303
|
+
let {
|
|
4304
|
+
content_blocks_: incoming_content_blocks,
|
|
4305
|
+
cols_at_size_: cols_at_size_,
|
|
4306
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
4307
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4308
|
+
} = _ref;
|
|
4309
|
+
// these are by row
|
|
4310
|
+
const [content_blocks, set_content_blocks] = $3hooq$solidjsstore.createStore([]);
|
|
4311
|
+
const n_cols_currently_showing_ = $85fcdab554c24789$export$a79e666719b3647c(cols_at_size_);
|
|
4312
|
+
const products_to_rows = products => {
|
|
4313
|
+
const cols_currently_showing = n_cols_currently_showing_();
|
|
4314
|
+
if (cols_currently_showing === null) return 0;
|
|
4315
|
+
return Math.ceil(products / cols_currently_showing);
|
|
4316
|
+
};
|
|
4317
|
+
const showing_rows = $3hooq$solidjs.createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
4318
|
+
$3hooq$solidjs.createEffect(() => {
|
|
4319
|
+
const incoming_value = incoming_content_blocks();
|
|
4320
|
+
if (!incoming_value) {
|
|
4321
|
+
set_content_blocks([]);
|
|
4322
|
+
return;
|
|
4323
|
+
}
|
|
4324
|
+
const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
|
|
4325
|
+
set_content_blocks($3hooq$solidjsstore.reconcile(capped_value));
|
|
4326
|
+
});
|
|
4327
|
+
const get_wrapped_blocks_ = $f8f375d6245ffff2$var$wrap_blocks_in_div(content_blocks, n_cols_currently_showing_);
|
|
4328
|
+
$3hooq$solidjs.createComputed(() => {
|
|
4329
|
+
// 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
|
|
4330
|
+
const top_row_block = get_wrapped_blocks_()[0];
|
|
4331
|
+
const blocks_in_top_row_taken = top_row_block === null || top_row_block === void 0 ? void 0 : top_row_block.span_columns;
|
|
4332
|
+
if (blocks_in_top_row_taken == undefined) {
|
|
4333
|
+
// Fall back to zero if no content block in top row, since then no blocks in top row are taken
|
|
4334
|
+
set_top_row_shortened_by_(0);
|
|
4335
|
+
return;
|
|
4336
|
+
}
|
|
4337
|
+
set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
|
|
4338
|
+
});
|
|
4339
|
+
|
|
4340
|
+
return $f8f375d6245ffff2$var$remap_blocks_to_index({
|
|
4341
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
4342
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
4343
|
+
});
|
|
4344
|
+
}
|
|
4345
|
+
/**
|
|
4346
|
+
* Calculate where to put each of the finished wrapped content blocks. Also limit blocks' max width.
|
|
4347
|
+
* @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
|
|
4348
|
+
*/
|
|
4349
|
+
function $f8f375d6245ffff2$var$remap_blocks_to_index(_ref2) {
|
|
4350
|
+
let {
|
|
4351
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
4352
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
4353
|
+
} = _ref2;
|
|
4354
|
+
return $3hooq$solidjs.createMemo(() => {
|
|
4355
|
+
// This computation should be quite cheap since it just moves around things into an array
|
|
4356
|
+
const content_blocks_by_index = [];
|
|
4357
|
+
const constructed_block_arrays = new WeakSet();
|
|
4358
|
+
const wrapped_blocks = get_wrapped_blocks_();
|
|
4359
|
+
const cols_showing = n_cols_currently_showing_();
|
|
4360
|
+
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
4361
|
+
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
|
|
4362
|
+
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
4363
|
+
// i = row to show at
|
|
4364
|
+
const block = wrapped_blocks[i];
|
|
4365
|
+
if (!block) continue; // Array can have holes/not defined places
|
|
4366
|
+
const index_of_first_item_in_row = i * cols_showing;
|
|
4367
|
+
const index_of_last_item_in_row = index_of_first_item_in_row + cols_showing;
|
|
4368
|
+
const {
|
|
4369
|
+
span_rows: span_rows,
|
|
4370
|
+
position: position,
|
|
4371
|
+
span_columns: span_columns
|
|
4372
|
+
} = block; // span columns is already capped in the block wrapping step (wrap_blocks_in_div)
|
|
4373
|
+
let target_index;
|
|
4374
|
+
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));
|
|
4375
|
+
// Calculate displacement of us by content blocks above us
|
|
4376
|
+
let displacement_by_added_blocks = 0;
|
|
4377
|
+
for (let j = 0; j < i; j++) {
|
|
4378
|
+
const row = displaced_products[j];
|
|
4379
|
+
if (row === undefined) continue; // there were no blocks in this row
|
|
4380
|
+
let items_in_row;
|
|
4381
|
+
if (typeof row === "number") items_in_row = row;else {
|
|
4382
|
+
items_in_row = row.filter(item => item).length;
|
|
4383
|
+
displaced_products[j] = items_in_row;
|
|
4384
|
+
}
|
|
4385
|
+
displacement_by_added_blocks += items_in_row;
|
|
4386
|
+
}
|
|
4387
|
+
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
4388
|
+
for (let j = 0; j < index_of_us_in_row; j++) {
|
|
4389
|
+
var _displaced_products$i;
|
|
4390
|
+
if ((_displaced_products$i = displaced_products[i]) !== null && _displaced_products$i !== void 0 && _displaced_products$i[j])
|
|
4391
|
+
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
4392
|
+
displacement_by_added_blocks++;
|
|
4393
|
+
}
|
|
4394
|
+
// Add block to output array at the correct index
|
|
4395
|
+
const final_target_index = target_index - displacement_by_added_blocks;
|
|
4396
|
+
const existing_block = content_blocks_by_index[final_target_index];
|
|
4397
|
+
const block_content = block.content;
|
|
4398
|
+
// 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
|
|
4399
|
+
if (existing_block) {
|
|
4400
|
+
if (constructed_block_arrays.has(existing_block))
|
|
4401
|
+
// Only push to arrays we have created to not create funky bugs when there's an array in JSX.Element
|
|
4402
|
+
existing_block.push(block_content);else {
|
|
4403
|
+
const array = [existing_block, block_content];
|
|
4404
|
+
constructed_block_arrays.add(array);
|
|
4405
|
+
content_blocks_by_index[final_target_index] = array;
|
|
4406
|
+
}
|
|
4407
|
+
} else content_blocks_by_index[final_target_index] = block_content;
|
|
4408
|
+
// Update displacement
|
|
4409
|
+
for (let j = 0; j < span_rows; j++) {
|
|
4410
|
+
var _ref3;
|
|
4411
|
+
const row = displaced_products[_ref3 = i + j] || (displaced_products[_ref3] = []);
|
|
4412
|
+
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4415
|
+
return content_blocks_by_index;
|
|
4416
|
+
});
|
|
4417
|
+
}
|
|
4418
|
+
/**
|
|
4419
|
+
* 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.
|
|
4420
|
+
* Then renders the content and wraps it into a div with the correct styling.
|
|
4421
|
+
* Also caps span_columns to max available columns
|
|
4422
|
+
*/
|
|
4423
|
+
function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
4424
|
+
const get_wrapped_blocks = $3hooq$solidjs.mapArray(() => rendered_content_blocks, block => {
|
|
4425
|
+
if (!block) return;
|
|
4426
|
+
const get_span_columns = () => {
|
|
4427
|
+
var _max_span_columns;
|
|
4428
|
+
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
4429
|
+
};
|
|
4430
|
+
return $3hooq$solidjs.mergeProps(block, {
|
|
4431
|
+
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
4432
|
+
content: $3hooq$solidjsweb.ssr($f8f375d6245ffff2$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "grid-column:" + "span ".concat($3hooq$solidjsweb.escape(get_span_columns(), true)) + (";grid-row:" + "span ".concat($3hooq$solidjsweb.escape(block.span_rows, true))) + (";spans_columns_variable_name:" + $3hooq$solidjsweb.escape(get_span_columns(), true)), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent($f8f375d6245ffff2$var$RenderContent, {
|
|
4433
|
+
get content() {
|
|
4434
|
+
return block.content;
|
|
4435
|
+
}
|
|
4436
|
+
}))),
|
|
4437
|
+
get span_columns() {
|
|
4438
|
+
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4439
|
+
return get_span_columns();
|
|
4440
|
+
}
|
|
4441
|
+
});
|
|
4442
|
+
});
|
|
4443
|
+
return get_wrapped_blocks;
|
|
4444
|
+
}
|
|
4445
|
+
/**
|
|
4446
|
+
* 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.
|
|
4447
|
+
*/
|
|
4448
|
+
function $f8f375d6245ffff2$var$RenderContent(props) {
|
|
4449
|
+
const [resource] = $3hooq$solidjs.createResource(() => props.content,
|
|
4450
|
+
// Could be reactive
|
|
4451
|
+
fn => fn());
|
|
4452
|
+
$3hooq$solidjs.createEffect(() => {
|
|
4453
|
+
if (resource.error) console.error("Error in content block rendering", resource.error);
|
|
4454
|
+
});
|
|
4455
|
+
// 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)
|
|
4456
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
|
|
4457
|
+
get fallback() {
|
|
4458
|
+
return $3hooq$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
|
|
4459
|
+
width: "100%",
|
|
4460
|
+
height: "max(100%, 400px)"
|
|
4461
|
+
});
|
|
4462
|
+
},
|
|
4463
|
+
children: resource
|
|
4464
|
+
});
|
|
4465
|
+
}
|
|
4108
4466
|
const $484eec37514a982e$var$_tmpl$ = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"];
|
|
4109
4467
|
function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
4110
4468
|
let {
|
|
@@ -4121,7 +4479,8 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4121
4479
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
4122
4480
|
product_card_template_: product_card_template_,
|
|
4123
4481
|
layout_options_: layout_options_,
|
|
4124
|
-
id_currently_querying_for_: id_currently_querying_for_
|
|
4482
|
+
id_currently_querying_for_: id_currently_querying_for_,
|
|
4483
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
4125
4484
|
} = _ref;
|
|
4126
4485
|
// 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
|
|
4127
4486
|
const is_loading_ = $3hooq$solidjs.createMemo(() => plp_results_.loading || query_base_.loading);
|
|
@@ -4164,24 +4523,37 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4164
4523
|
let is_just_after_plp_results_update = false;
|
|
4165
4524
|
let fallback_is_alive = false;
|
|
4166
4525
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $3hooq$solidjs.createSignal(true);
|
|
4526
|
+
const [top_row_shortened_by_, set_top_row_shortened_by_] = $3hooq$solidjs.createSignal(0);
|
|
4527
|
+
const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $3hooq$solidjs.createSignal(false);
|
|
4528
|
+
const [number_loaded_displays, set_number_loaded_displays_] = $3hooq$solidjs.createSignal(0);
|
|
4529
|
+
const modified_cols_at_size = $c749e60bca5000cb$export$cb5808ba002cdeed({
|
|
4530
|
+
layout_options_: layout_options_,
|
|
4531
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
4532
|
+
});
|
|
4533
|
+
const num_placeholders_ = $3hooq$solidjs.createMemo(() => {
|
|
4534
|
+
var _get_scroll_restorati, _get_scroll_restorati2;
|
|
4535
|
+
// 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
|
|
4536
|
+
return (0, $da887c42f8e8847a$export$6c9030e511152266) + ((_get_scroll_restorati = (_get_scroll_restorati2 = get_scroll_restoration_data().find(_ref2 => {
|
|
4537
|
+
let {
|
|
4538
|
+
for_id: for_id
|
|
4539
|
+
} = _ref2;
|
|
4540
|
+
return for_id === id_currently_querying_for_();
|
|
4541
|
+
})) === 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_);
|
|
4542
|
+
});
|
|
4543
|
+
const number_of_items_shown_ = $3hooq$solidjs.createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
4544
|
+
const doesnt_have_content_blocks = $3hooq$solidjs.createMemo(() => !content_blocks_by_row_());
|
|
4545
|
+
const content_blocks_ = $3hooq$solidjs.createMemo(() => doesnt_have_content_blocks() ? () => [] : $f8f375d6245ffff2$export$791ef57e62e21c3f({
|
|
4546
|
+
content_blocks_: content_blocks_by_row_,
|
|
4547
|
+
cols_at_size_: modified_cols_at_size,
|
|
4548
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
4549
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4550
|
+
}));
|
|
4167
4551
|
const rendered_placeholders = $3hooq$solidjs.createMemo(() => get_should_have_placeholders_rendered() ? $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
4552
|
+
content_blocks_: content_blocks_,
|
|
4168
4553
|
product_card_template_: product_card_template_,
|
|
4169
|
-
num_placeholders_:
|
|
4170
|
-
var _get_scroll_restorati, _get_scroll_restorati2;
|
|
4171
|
-
// 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
|
|
4172
|
-
return (0, $da887c42f8e8847a$export$6c9030e511152266) + ((_get_scroll_restorati = (_get_scroll_restorati2 = get_scroll_restoration_data().find(_ref2 => {
|
|
4173
|
-
let {
|
|
4174
|
-
for_id: for_id
|
|
4175
|
-
} = _ref2;
|
|
4176
|
-
return for_id === id_currently_querying_for_();
|
|
4177
|
-
})) === 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_);
|
|
4178
|
-
})
|
|
4554
|
+
num_placeholders_: num_placeholders_
|
|
4179
4555
|
}) : undefined);
|
|
4180
4556
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $3hooq$solidjs.createSignal(false);
|
|
4181
|
-
const modified_cols_at_size = $484eec37514a982e$var$make_modified_cols_at_size({
|
|
4182
|
-
layout_options_: layout_options_,
|
|
4183
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
4184
|
-
});
|
|
4185
4557
|
const block_suspense_if_needed = () => {
|
|
4186
4558
|
if (!is_just_after_plp_results_update) return;
|
|
4187
4559
|
is_just_after_plp_results_update = false;
|
|
@@ -4214,6 +4586,8 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4214
4586
|
return (() => {
|
|
4215
4587
|
fallback_is_alive = true;
|
|
4216
4588
|
$3hooq$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4589
|
+
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
4590
|
+
$3hooq$solidjs.onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
4217
4591
|
return $3hooq$solidjs.createMemo(() => {
|
|
4218
4592
|
// 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
|
|
4219
4593
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -4238,37 +4612,64 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4238
4612
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
4239
4613
|
query_base_: query_base_,
|
|
4240
4614
|
depict_api_: depict_api_,
|
|
4241
|
-
is_loading_: is_loading_
|
|
4615
|
+
is_loading_: is_loading_,
|
|
4616
|
+
content_blocks_: content_blocks_,
|
|
4617
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4242
4618
|
});
|
|
4243
4619
|
$3hooq$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
4244
4620
|
return suspense_contents;
|
|
4245
4621
|
})();
|
|
4246
4622
|
}
|
|
4247
4623
|
});
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4624
|
+
/* 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 */
|
|
4625
|
+
const listing_contents = $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
4626
|
+
get when() {
|
|
4627
|
+
return !is_loading_();
|
|
4251
4628
|
},
|
|
4252
|
-
get
|
|
4253
|
-
return
|
|
4629
|
+
get fallback() {
|
|
4630
|
+
return rendered_placeholders();
|
|
4254
4631
|
},
|
|
4255
|
-
|
|
4256
|
-
|
|
4632
|
+
children: product_cards_when_data
|
|
4633
|
+
});
|
|
4634
|
+
return [$8edd3cf30d1fd8b4$export$a2cc176055f8f08(), $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
4635
|
+
get when() {
|
|
4636
|
+
return doesnt_have_content_blocks();
|
|
4257
4637
|
},
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4638
|
+
get fallback() {
|
|
4639
|
+
return $3hooq$solidjsweb.createComponent((0, $830518481649feb1$export$ab6b147eec64fea5), {
|
|
4640
|
+
get cols_at_size() {
|
|
4641
|
+
return modified_cols_at_size();
|
|
4642
|
+
},
|
|
4643
|
+
get override_vertical_spacing() {
|
|
4644
|
+
return layout_options_().override_vertical_spacing;
|
|
4645
|
+
},
|
|
4646
|
+
get grid_spacing() {
|
|
4647
|
+
return layout_options_().grid_spacing;
|
|
4648
|
+
},
|
|
4649
|
+
element_attributes: {
|
|
4650
|
+
class: "cards css-grid"
|
|
4651
|
+
},
|
|
4652
|
+
top_row_shortened_by_: top_row_shortened_by_,
|
|
4653
|
+
children: listing_contents
|
|
4654
|
+
});
|
|
4262
4655
|
},
|
|
4263
4656
|
get children() {
|
|
4264
|
-
return $3hooq$solidjsweb.createComponent((0, $
|
|
4265
|
-
get
|
|
4266
|
-
return
|
|
4657
|
+
return $3hooq$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
|
|
4658
|
+
get cols_at_size() {
|
|
4659
|
+
return modified_cols_at_size();
|
|
4660
|
+
},
|
|
4661
|
+
get override_vertical_spacing() {
|
|
4662
|
+
return layout_options_().override_vertical_spacing;
|
|
4663
|
+
},
|
|
4664
|
+
get grid_spacing() {
|
|
4665
|
+
return layout_options_().grid_spacing;
|
|
4267
4666
|
},
|
|
4268
|
-
|
|
4269
|
-
|
|
4667
|
+
rows: "all",
|
|
4668
|
+
layout: "grid",
|
|
4669
|
+
element_attributes: {
|
|
4670
|
+
class: "cards"
|
|
4270
4671
|
},
|
|
4271
|
-
children:
|
|
4672
|
+
children: listing_contents
|
|
4272
4673
|
});
|
|
4273
4674
|
}
|
|
4274
4675
|
})];
|
|
@@ -4277,36 +4678,6 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4277
4678
|
}
|
|
4278
4679
|
})), $3hooq$solidjsweb.escape(desktop_filter_elements_()));
|
|
4279
4680
|
}
|
|
4280
|
-
/**
|
|
4281
|
-
* Changes cols_at_size depending on if filters are open or not so one card less is shown when the filters are open
|
|
4282
|
-
* This function is special to the actual PLPResults.
|
|
4283
|
-
*/
|
|
4284
|
-
function $484eec37514a982e$var$make_modified_cols_at_size(_ref3) {
|
|
4285
|
-
let {
|
|
4286
|
-
layout_options_: layout_options_,
|
|
4287
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
4288
|
-
} = _ref3;
|
|
4289
|
-
return $3hooq$solidjs.createMemo(() => {
|
|
4290
|
-
const layout_options = layout_options_();
|
|
4291
|
-
// Add grid styling that changes when filters get opened/closed
|
|
4292
|
-
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
4293
|
-
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
4294
|
-
const [num_cols_default,,,, override_cols] = row;
|
|
4295
|
-
const cloned_row = [...row];
|
|
4296
|
-
// @ts-ignore
|
|
4297
|
-
cloned_row[0] = num_cols_default - 1;
|
|
4298
|
-
if (override_cols)
|
|
4299
|
-
// @ts-ignore
|
|
4300
|
-
cloned_row[4] = {
|
|
4301
|
-
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(_ref4 => {
|
|
4302
|
-
let [row, column] = _ref4;
|
|
4303
|
-
return [row, column - 1];
|
|
4304
|
-
}))
|
|
4305
|
-
};
|
|
4306
|
-
return cloned_row;
|
|
4307
|
-
}) : when_filters_closed_cols;
|
|
4308
|
-
});
|
|
4309
|
-
}
|
|
4310
4681
|
const $3bd211c857f81dfd$var$_tmpl$ = ["<div", ' class="sorting-attributes">', "</div>"],
|
|
4311
4682
|
$3bd211c857f81dfd$var$_tmpl$2 = ["<div", ' class="sorting-direction">', "</div>"],
|
|
4312
4683
|
$3bd211c857f81dfd$var$_tmpl$3 = ["<div", '><div class="input-row"><input type="radio"', '><span class="custom-indicator"></span><!--#-->', "<!--/--></div></div>"],
|
|
@@ -5584,7 +5955,8 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
5584
5955
|
product_card_template_: product_card_template_,
|
|
5585
5956
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
5586
5957
|
sorting_query_param_: sorting_query_param_,
|
|
5587
|
-
filter_query_param_prefix_: filter_query_param_prefix_
|
|
5958
|
+
filter_query_param_prefix_: filter_query_param_prefix_,
|
|
5959
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
5588
5960
|
} = _ref;
|
|
5589
5961
|
let results_for;
|
|
5590
5962
|
let only_show_filters_opener_;
|
|
@@ -5860,6 +6232,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
5860
6232
|
product_card_template_: product_card_template_,
|
|
5861
6233
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
5862
6234
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
6235
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
5863
6236
|
id_currently_querying_for_: query_id_,
|
|
5864
6237
|
no_results_options_: {
|
|
5865
6238
|
selected_filters_: selected_filters_,
|
|
@@ -6466,6 +6839,7 @@ function $9cbefc32b9dab36d$export$e2bf8ce7779e827e(props) {
|
|
|
6466
6839
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
6467
6840
|
selected_filters_: selected_filters_,
|
|
6468
6841
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
6842
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
6469
6843
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
6470
6844
|
layout_options_: $3hooq$solidjs.createMemo(() => ({
|
|
6471
6845
|
cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
|
|
@@ -6698,37 +7072,6 @@ async function $822f2c95a96c3ec8$var$download_categories(tenant, market, type) {
|
|
|
6698
7072
|
return [];
|
|
6699
7073
|
}
|
|
6700
7074
|
}
|
|
6701
|
-
function $b8a8d61b3ec5f5ac$export$3f37af283f8fb843(props) {
|
|
6702
|
-
const style = $3hooq$solidjs.createMemo(() => {
|
|
6703
|
-
const {
|
|
6704
|
-
style: style,
|
|
6705
|
-
height: height,
|
|
6706
|
-
width: width,
|
|
6707
|
-
aspectRatio: aspectRatio
|
|
6708
|
-
} = props;
|
|
6709
|
-
const is_image = aspectRatio != undefined;
|
|
6710
|
-
const size_data = is_image ? {
|
|
6711
|
-
width: "100%",
|
|
6712
|
-
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
6713
|
-
} : {
|
|
6714
|
-
width: width,
|
|
6715
|
-
height: height
|
|
6716
|
-
};
|
|
6717
|
-
return {
|
|
6718
|
-
display: "block",
|
|
6719
|
-
...(style || {}),
|
|
6720
|
-
...size_data
|
|
6721
|
-
};
|
|
6722
|
-
});
|
|
6723
|
-
return $3hooq$solidjsweb.createComponent((0, $e3d733f899558f40$export$acb3eaade4b23afd), {
|
|
6724
|
-
get style() {
|
|
6725
|
-
return style();
|
|
6726
|
-
},
|
|
6727
|
-
get ["class"]() {
|
|
6728
|
-
return props.class;
|
|
6729
|
-
}
|
|
6730
|
-
});
|
|
6731
|
-
}
|
|
6732
7075
|
const $c0cf6af094336798$var$_tmpl$ = ["<div", ' class="instant-card"><div class="img-part">', '</div><div class="right-part"><div class="title-brand-tagline"><span class="title">', "</span></div></div></div>"];
|
|
6733
7076
|
function $c0cf6af094336798$export$ee1733d9a8495996() {
|
|
6734
7077
|
return $3hooq$solidjsweb.ssr($c0cf6af094336798$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
|
|
@@ -8719,7 +9062,8 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
8719
9062
|
router_: router_,
|
|
8720
9063
|
content_results_rows_: content_results_rows_,
|
|
8721
9064
|
content_layout_options_: content_layout_options_,
|
|
8722
|
-
content_search_enabled_: content_search_enabled_
|
|
9065
|
+
content_search_enabled_: content_search_enabled_,
|
|
9066
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
8723
9067
|
} = _ref;
|
|
8724
9068
|
const [get_sorting] = current_sorting_;
|
|
8725
9069
|
const all_products_loaded_ = $3hooq$solidjs.createSignal(false);
|
|
@@ -8985,6 +9329,7 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
8985
9329
|
layout_options_: layout_options_,
|
|
8986
9330
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
8987
9331
|
id_currently_querying_for_: get_search_query_,
|
|
9332
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
8988
9333
|
no_results_options_: {
|
|
8989
9334
|
selected_filters_: selected_filters_,
|
|
8990
9335
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -9512,6 +9857,7 @@ function $ddd39c5f36f49703$export$f2dc7e4e4aa11abb(props) {
|
|
|
9512
9857
|
search_sorting_open_: state_.sorting_open,
|
|
9513
9858
|
expanded_filters_: state_.expanded_filters,
|
|
9514
9859
|
content_results_rows_: state_.content_results_rows,
|
|
9860
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
9515
9861
|
router_: shared_properties.router_,
|
|
9516
9862
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
9517
9863
|
return $3001ad378baf39dc$export$d757d54550ebfb3d({
|