@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.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { add_to_version_info as $b8hua$add_to_version_info, base64_encode_unicode as $b8hua$base64_encode_unicode, base64_decode_unicode as $b8hua$base64_decode_unicode, dlog as $b8hua$dlog, queueMacroTask as $b8hua$queueMacroTask, catchify as $b8hua$catchify, is_safari as $b8hua$is_safari, observer as $b8hua$observer, Amazing_Slider as $b8hua$Amazing_Slider, slider_snap_css as $b8hua$slider_snap_css, slider_fading_factory as $b8hua$slider_fading_factory, slider_fractional_factory as $b8hua$slider_fractional_factory, camelCasifyObject as $b8hua$camelCasifyObject, make_random_classname as $b8hua$make_random_classname, n_col_styling_with_dist as $b8hua$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $b8hua$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $b8hua$layout_get_total_rec_amount_for_row, layout_media_query_header as $b8hua$layout_media_query_header, report as $b8hua$report, useExpandingContainer as $b8hua$useExpandingContainer, standard_price_format as $b8hua$standard_price_format, hex_to_rgb as $b8hua$hex_to_rgb, relative_luminance_from_rgb as $b8hua$relative_luminance_from_rgb, fetch_recs as $b8hua$fetch_recs, snakeCasifyObject as $b8hua$snakeCasifyObject, instant_exec_on_suspect_history_change as $b8hua$instant_exec_on_suspect_history_change, base_url as $b8hua$base_url, get_depict_id as $b8hua$get_depict_id, get_user_id as $b8hua$get_user_id, get_session_id as $b8hua$get_session_id, make_url_with_query_params as $b8hua$make_url_with_query_params, fetch_retry as $b8hua$fetch_retry, add_version_query_params as $b8hua$add_version_query_params, dwarn as $b8hua$dwarn, sort_obj as $b8hua$sort_obj, edit_current_page_meta_tags as $b8hua$edit_current_page_meta_tags, javascript_media_query as $b8hua$javascript_media_query, use_href_accessor as $b8hua$use_href_accessor, make_asyncIterable_exiter as $b8hua$make_asyncIterable_exiter, href_change_ipns as $b8hua$href_change_ipns, ContainedImage as $b8hua$ContainedImage, deparallelize_no_drop as $b8hua$deparallelize_no_drop, ListenableSet as $b8hua$ListenableSet, insert_surfaces as $b8hua$insert_surfaces } from "@depict-ai/utilishared/ES10";
|
|
2
2
|
import { createComponent as $b8hua$createComponent, ssr as $b8hua$ssr, ssrHydrationKey as $b8hua$ssrHydrationKey, ssrStyle as $b8hua$ssrStyle, ssrElement as $b8hua$ssrElement, escape as $b8hua$escape, insert as $b8hua$insert, ssrAttribute as $b8hua$ssrAttribute, mergeProps as $b8hua$mergeProps, isServer as $b8hua$isServer, ssrClassList as $b8hua$ssrClassList, Dynamic as $b8hua$Dynamic } from "solid-js/web";
|
|
3
|
-
import { createSignal as $b8hua$createSignal, getOwner as $b8hua$getOwner, createEffect as $b8hua$createEffect, runWithOwner as $b8hua$runWithOwner, onCleanup as $b8hua$onCleanup, createMemo as $b8hua$createMemo, createContext as $b8hua$createContext, useContext as $b8hua$useContext, createResource as $b8hua$createResource, Suspense as $b8hua$Suspense, Show as $b8hua$Show, createRenderEffect as $b8hua$createRenderEffect, createRoot as $b8hua$createRoot, For as $b8hua$For, createUniqueId as $b8hua$createUniqueId,
|
|
3
|
+
import { createSignal as $b8hua$createSignal, getOwner as $b8hua$getOwner, createEffect as $b8hua$createEffect, runWithOwner as $b8hua$runWithOwner, onCleanup as $b8hua$onCleanup, createMemo as $b8hua$createMemo, createContext as $b8hua$createContext, useContext as $b8hua$useContext, createResource as $b8hua$createResource, Suspense as $b8hua$Suspense, Show as $b8hua$Show, untrack as $b8hua$untrack, createRenderEffect as $b8hua$createRenderEffect, Index as $b8hua$Index, createRoot as $b8hua$createRoot, For as $b8hua$For, createUniqueId as $b8hua$createUniqueId, createComputed as $b8hua$createComputed, ErrorBoundary as $b8hua$ErrorBoundary, on as $b8hua$on, batch as $b8hua$batch, createReaction as $b8hua$createReaction, mapArray as $b8hua$mapArray, mergeProps as $b8hua$mergeProps1 } from "solid-js";
|
|
4
4
|
import $b8hua$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
|
|
5
5
|
import $b8hua$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
|
|
6
6
|
import $b8hua$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
+
import { createStore as $b8hua$createStore, reconcile as $b8hua$reconcile } from "solid-js/store";
|
|
7
8
|
|
|
8
9
|
/*! Depict.ai search and product listing SDK */
|
|
9
10
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
10
11
|
register_es_version("ui", "ES10");
|
|
11
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0
|
|
12
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.0";
|
|
12
13
|
const $2855bffe06ef7a03$var$fallback_operator = "in";
|
|
13
14
|
const $2855bffe06ef7a03$var$fallback_token = "";
|
|
14
15
|
const $2855bffe06ef7a03$var$legacy_filter_prefix = "filter_";
|
|
@@ -414,7 +415,7 @@ const $a9c7ba6087881ac2$export$6daf8749b65a1b77 = cols_at_size => {
|
|
|
414
415
|
return $a9c7ba6087881ac2$var$transform_elements(sorted_cols_at_size);
|
|
415
416
|
};
|
|
416
417
|
function $ca55612a53dbbdd2$export$a2cc176055f8f08() {
|
|
417
|
-
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.";
|
|
418
|
+
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.";
|
|
418
419
|
return (0, $b8hua$isServer) ? {
|
|
419
420
|
t: "<!-- ".concat(text, " -->")
|
|
420
421
|
} : document.createComment(text);
|
|
@@ -436,12 +437,13 @@ let $bdd80c7862246dc2$var$rendering_cached_placeholder_element;
|
|
|
436
437
|
function $bdd80c7862246dc2$export$f33414a4df0afd3f(_ref) {
|
|
437
438
|
let {
|
|
438
439
|
product_card_template_: product_card_template_,
|
|
439
|
-
num_placeholders_: num_placeholders_
|
|
440
|
+
num_placeholders_: num_placeholders_,
|
|
441
|
+
content_blocks_: content_blocks_
|
|
440
442
|
} = _ref;
|
|
441
|
-
const [
|
|
442
|
-
let existing_num = 0;
|
|
443
|
+
const [num_to_actually_show, set_num_to_actually_show] = $b8hua$createSignal($b8hua$untrack(num_placeholders_));
|
|
443
444
|
if (0, $b8hua$isServer)
|
|
444
445
|
// want to render simple placeholders on server, effects don't run there
|
|
446
|
+
// FIXME when adding proper SSR: also SSR content blocks
|
|
445
447
|
return $b8hua$createMemo(() => Array.from({
|
|
446
448
|
length: num_placeholders_()
|
|
447
449
|
}).map(() => {
|
|
@@ -450,19 +452,33 @@ function $bdd80c7862246dc2$export$f33414a4df0afd3f(_ref) {
|
|
|
450
452
|
if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
|
|
451
453
|
}));
|
|
452
454
|
$b8hua$createRenderEffect(() => {
|
|
455
|
+
const existing_num = num_to_actually_show();
|
|
453
456
|
const to_add = num_placeholders_() - existing_num;
|
|
454
457
|
if (to_add <= 0) return;
|
|
455
458
|
// 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.
|
|
456
459
|
// 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.
|
|
457
460
|
// 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.
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
461
|
+
// 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
|
|
462
|
+
// Functionality should be the same
|
|
463
|
+
set_num_to_actually_show(existing_num + to_add);
|
|
464
|
+
});
|
|
465
|
+
return $b8hua$createComponent((0, $b8hua$Index), {
|
|
466
|
+
get each() {
|
|
467
|
+
return Array.from({
|
|
468
|
+
length: num_to_actually_show()
|
|
469
|
+
});
|
|
470
|
+
},
|
|
471
|
+
children: (_item, index) => {
|
|
472
|
+
const possible_content_block = $b8hua$createMemo(() => {
|
|
473
|
+
var _content_blocks_, _content_blocks_2;
|
|
474
|
+
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];
|
|
475
|
+
});
|
|
476
|
+
// Show content block before product card, so it's *at* that index
|
|
477
|
+
return [possible_content_block, $bdd80c7862246dc2$var$Placeholder({
|
|
478
|
+
product_card_template_: product_card_template_
|
|
479
|
+
})]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
480
|
+
}
|
|
464
481
|
});
|
|
465
|
-
return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
466
482
|
}
|
|
467
483
|
/**
|
|
468
484
|
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
@@ -553,7 +569,8 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
|
553
569
|
merchant_: merchant_,
|
|
554
570
|
market_: market_,
|
|
555
571
|
product_card_template_: product_card_template_,
|
|
556
|
-
do_per_elements_: do_per_elements_
|
|
572
|
+
do_per_elements_: do_per_elements_,
|
|
573
|
+
content_blocks_: content_blocks_
|
|
557
574
|
} = _ref;
|
|
558
575
|
return $b8hua$createComponent((0, $b8hua$For), {
|
|
559
576
|
get each() {
|
|
@@ -561,6 +578,10 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
|
561
578
|
},
|
|
562
579
|
children: (product_id, index) => {
|
|
563
580
|
const owner = $b8hua$getOwner();
|
|
581
|
+
const possible_content_block = $b8hua$createMemo(() => {
|
|
582
|
+
var _content_blocks_, _content_blocks_2;
|
|
583
|
+
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()];
|
|
584
|
+
});
|
|
564
585
|
const display_accessor = $b8hua$createMemo(prev => {
|
|
565
586
|
const new_display = displays_by_key_().get(product_id);
|
|
566
587
|
if (prev && $2d7bad8684bc7f44$var$deep_equal(prev, new_display))
|
|
@@ -614,7 +635,9 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
|
614
635
|
}
|
|
615
636
|
do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
|
|
616
637
|
});
|
|
617
|
-
return
|
|
638
|
+
return [
|
|
639
|
+
// Show content block before product card, so it's *at* that index
|
|
640
|
+
possible_content_block, product_card_resource]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
618
641
|
}
|
|
619
642
|
});
|
|
620
643
|
}
|
|
@@ -3215,11 +3238,14 @@ function $68e6625c8d51f847$var$proxy_push_state(function_name, thing) {
|
|
|
3215
3238
|
thing[function_name] = new Proxy(thing[function_name], {
|
|
3216
3239
|
apply(target, this_arg, arg_list) {
|
|
3217
3240
|
try {
|
|
3218
|
-
|
|
3241
|
+
const old_state = history.state;
|
|
3242
|
+
if (typeof old_state == "object" && old_state !== null) {
|
|
3243
|
+
var _arg_list$;
|
|
3244
|
+
// This effectively disallows the user from passing in a string, number, null or undefined
|
|
3245
|
+
const intended_new_value_as_obj = typeof arg_list[0] === "object" ? (_arg_list$ = arg_list[0]) !== null && _arg_list$ !== void 0 ? _arg_list$ : {} : {};
|
|
3219
3246
|
const cloned_object = {
|
|
3220
|
-
...
|
|
3247
|
+
...intended_new_value_as_obj
|
|
3221
3248
|
};
|
|
3222
|
-
const old_state = history.state;
|
|
3223
3249
|
for (const key in old_state) {
|
|
3224
3250
|
if (!$68e6625c8d51f847$var$starts_with_any_prefix(key)) continue;
|
|
3225
3251
|
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
@@ -3965,7 +3991,9 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
3965
3991
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
3966
3992
|
query_base_: query_base_,
|
|
3967
3993
|
depict_api_: depict_api_,
|
|
3968
|
-
is_loading_: is_loading_
|
|
3994
|
+
is_loading_: is_loading_,
|
|
3995
|
+
content_blocks_: content_blocks_,
|
|
3996
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
3969
3997
|
} = _ref;
|
|
3970
3998
|
// 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
|
|
3971
3999
|
const target_to_index_map = new Map();
|
|
@@ -4012,11 +4040,13 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
4012
4040
|
query_base_: query_base_,
|
|
4013
4041
|
depict_api_: depict_api_
|
|
4014
4042
|
});
|
|
4043
|
+
$b8hua$createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
4015
4044
|
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
4016
4045
|
displays_by_key_: displays_by_key_,
|
|
4017
4046
|
merchant_: merchant_,
|
|
4018
4047
|
market_: market_,
|
|
4019
4048
|
product_card_template_: product_card_template_,
|
|
4049
|
+
content_blocks_: content_blocks_,
|
|
4020
4050
|
do_per_elements_: (elements, index_accessor) =>
|
|
4021
4051
|
// Adds/removes elements from the "results in viewport" intersection observer above
|
|
4022
4052
|
$b8hua$createEffect(() => {
|
|
@@ -4038,6 +4068,334 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
4038
4068
|
})
|
|
4039
4069
|
});
|
|
4040
4070
|
}
|
|
4071
|
+
const $64d94dcaa058dc7b$var$_tmpl$ = ["<style", ' type="text/css">', "</style>"];
|
|
4072
|
+
const $64d94dcaa058dc7b$export$c500183c31c2b22e = "--spans-columns";
|
|
4073
|
+
function $64d94dcaa058dc7b$export$ab6b147eec64fea5(props) {
|
|
4074
|
+
const container_class = "x" + $b8hua$createUniqueId();
|
|
4075
|
+
const container_element_ = $b8hua$ssrElement("div", () => ({
|
|
4076
|
+
...props.element_attributes,
|
|
4077
|
+
"classList": {
|
|
4078
|
+
[container_class]: true
|
|
4079
|
+
}
|
|
4080
|
+
}), () => $b8hua$escape(props.children), true); // Don't want this in the error boundary below, it should only be for the actual layouting
|
|
4081
|
+
return $b8hua$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
4082
|
+
message_: "Failed calculating css grid layout",
|
|
4083
|
+
severity_: "error",
|
|
4084
|
+
get children() {
|
|
4085
|
+
return $64d94dcaa058dc7b$export$e2f22da34aaf310a(props, container_element_, false, container_class);
|
|
4086
|
+
}
|
|
4087
|
+
});
|
|
4088
|
+
}
|
|
4089
|
+
function $64d94dcaa058dc7b$export$e2f22da34aaf310a(props, container_element) {
|
|
4090
|
+
let insert_after_container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4091
|
+
let container_class = arguments.length > 3 ? arguments[3] : undefined;
|
|
4092
|
+
if (!container_class) {
|
|
4093
|
+
// only try to add if it wasn't provided, so that we have a code path without classList when doing SSR
|
|
4094
|
+
container_class = $b8hua$make_random_classname();
|
|
4095
|
+
container_element.classList.add(container_class);
|
|
4096
|
+
}
|
|
4097
|
+
const container_selector = ".depict .".concat(container_class); // class so ppl can have id if needed
|
|
4098
|
+
const col_styling = $b8hua$createMemo(() => $64d94dcaa058dc7b$var$generate_media_queried_declarations({
|
|
4099
|
+
container_selector_: container_selector,
|
|
4100
|
+
default_grid_spacing_text: props.grid_spacing,
|
|
4101
|
+
cols_at_size_: props.cols_at_size,
|
|
4102
|
+
override_vertical_spacing_: props.override_vertical_spacing,
|
|
4103
|
+
top_row_shortened_by_: props.top_row_shortened_by_()
|
|
4104
|
+
}));
|
|
4105
|
+
const base_styling = $b8hua$createMemo(() => {
|
|
4106
|
+
return "".concat(container_selector, "{display:grid;}");
|
|
4107
|
+
});
|
|
4108
|
+
const get_styling = $b8hua$createMemo(() => base_styling() + col_styling());
|
|
4109
|
+
const style_element = $b8hua$ssr($64d94dcaa058dc7b$var$_tmpl$, $b8hua$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
|
|
4110
|
+
if (insert_after_container) container_element.after(style_element);
|
|
4111
|
+
return [container_element, style_element];
|
|
4112
|
+
}
|
|
4113
|
+
function $64d94dcaa058dc7b$var$generate_media_queried_declarations(_ref) {
|
|
4114
|
+
let {
|
|
4115
|
+
container_selector_: container_selector_,
|
|
4116
|
+
default_grid_spacing_text: default_grid_spacing_text,
|
|
4117
|
+
cols_at_size_: cols_at_size_,
|
|
4118
|
+
override_vertical_spacing_: override_vertical_spacing_,
|
|
4119
|
+
top_row_shortened_by_: top_row_shortened_by_
|
|
4120
|
+
} = _ref;
|
|
4121
|
+
return cols_at_size_.map(options => {
|
|
4122
|
+
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
4123
|
+
const spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
4124
|
+
// See comment in else block below
|
|
4125
|
+
const can_use_gap = $64d94dcaa058dc7b$var$can_use_gap_for_unit(spacing_to_use) && (!override_vertical_spacing_ || $64d94dcaa058dc7b$var$can_use_gap_for_unit(override_vertical_spacing_));
|
|
4126
|
+
let spacing_styling;
|
|
4127
|
+
let additional_styling = ""; // outside the media query
|
|
4128
|
+
if (can_use_gap) spacing_styling = "gap:".concat(spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
|
|
4129
|
+
// 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)
|
|
4130
|
+
// 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.
|
|
4131
|
+
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
4132
|
+
// 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.
|
|
4133
|
+
const width_multiplier = "var(".concat($64d94dcaa058dc7b$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
|
|
4134
|
+
const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($64d94dcaa058dc7b$var$strip_percent_unit(spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
|
|
4135
|
+
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
4136
|
+
const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
|
|
4137
|
+
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($64d94dcaa058dc7b$var$strip_percent_unit(spacing_to_use), ")"); // Width of the gaps
|
|
4138
|
+
const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
|
|
4139
|
+
// 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
|
|
4140
|
+
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)
|
|
4141
|
+
spacing_styling = "column-gap:".concat(spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
|
|
4142
|
+
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
4143
|
+
additional_styling = $b8hua$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_);
|
|
4144
|
+
}
|
|
4145
|
+
const media_query_body = "".concat(container_selector_, "{").concat(spacing_styling, "grid-template-columns:repeat(").concat(n_cols, ",minmax(0,1fr));}");
|
|
4146
|
+
return "".concat($b8hua$layout_media_query_header(min, max), "{").concat(media_query_body, "}").concat(additional_styling);
|
|
4147
|
+
}).join("");
|
|
4148
|
+
}
|
|
4149
|
+
function $64d94dcaa058dc7b$var$can_use_gap_for_unit(spacing) {
|
|
4150
|
+
const trimmed_spacing = spacing.trim();
|
|
4151
|
+
return !trimmed_spacing.includes("%");
|
|
4152
|
+
}
|
|
4153
|
+
function $64d94dcaa058dc7b$var$strip_percent_unit(css_value) {
|
|
4154
|
+
return css_value.replaceAll("%", "");
|
|
4155
|
+
}
|
|
4156
|
+
function $b2dbaafb23d00c7f$export$cb5808ba002cdeed(_ref) {
|
|
4157
|
+
let {
|
|
4158
|
+
layout_options_: layout_options_,
|
|
4159
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
4160
|
+
} = _ref;
|
|
4161
|
+
return $b8hua$createMemo(() => {
|
|
4162
|
+
const layout_options = layout_options_();
|
|
4163
|
+
// Add grid styling that changes when filters get opened/closed
|
|
4164
|
+
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
4165
|
+
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
4166
|
+
const [num_cols_default,,,, override_cols] = row;
|
|
4167
|
+
const cloned_row = [...row];
|
|
4168
|
+
// @ts-ignore
|
|
4169
|
+
cloned_row[0] = num_cols_default - 1;
|
|
4170
|
+
if (override_cols)
|
|
4171
|
+
// @ts-ignore
|
|
4172
|
+
cloned_row[4] = {
|
|
4173
|
+
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(_ref2 => {
|
|
4174
|
+
let [row, column] = _ref2;
|
|
4175
|
+
return [row, column - 1];
|
|
4176
|
+
}))
|
|
4177
|
+
};
|
|
4178
|
+
return cloned_row;
|
|
4179
|
+
}) : when_filters_closed_cols;
|
|
4180
|
+
});
|
|
4181
|
+
}
|
|
4182
|
+
function $8244fdad249f8d5f$export$a79e666719b3647c(cols_at_size_) {
|
|
4183
|
+
const size_active = $b8hua$createMemo(() => cols_at_size_().map(_ref => {
|
|
4184
|
+
let [n_cols, min_width, max_width] = _ref;
|
|
4185
|
+
const media_query = $b8hua$layout_media_query_header(min_width, max_width).replaceAll("@media", "");
|
|
4186
|
+
const matches = $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query);
|
|
4187
|
+
return [matches, n_cols];
|
|
4188
|
+
}));
|
|
4189
|
+
const n_cols_currently_showing = $b8hua$createMemo(() => {
|
|
4190
|
+
try {
|
|
4191
|
+
const [, n_cols_currently_showing] = size_active().find(_ref2 => {
|
|
4192
|
+
let [media_query] = _ref2;
|
|
4193
|
+
return media_query();
|
|
4194
|
+
});
|
|
4195
|
+
return n_cols_currently_showing;
|
|
4196
|
+
} catch (e) {
|
|
4197
|
+
$b8hua$dwarn("No active size found in columnsAtSize - can't render content blocks");
|
|
4198
|
+
return null;
|
|
4199
|
+
}
|
|
4200
|
+
});
|
|
4201
|
+
return n_cols_currently_showing;
|
|
4202
|
+
}
|
|
4203
|
+
function $3ab4aa97880fb88d$export$3f37af283f8fb843(props) {
|
|
4204
|
+
const style = $b8hua$createMemo(() => {
|
|
4205
|
+
const {
|
|
4206
|
+
style: style,
|
|
4207
|
+
height: height,
|
|
4208
|
+
width: width,
|
|
4209
|
+
aspectRatio: aspectRatio
|
|
4210
|
+
} = props;
|
|
4211
|
+
const is_image = aspectRatio != undefined;
|
|
4212
|
+
const size_data = is_image ? {
|
|
4213
|
+
width: "100%",
|
|
4214
|
+
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
4215
|
+
} : {
|
|
4216
|
+
width: width,
|
|
4217
|
+
height: height
|
|
4218
|
+
};
|
|
4219
|
+
return {
|
|
4220
|
+
display: "block",
|
|
4221
|
+
...(style || {}),
|
|
4222
|
+
...size_data
|
|
4223
|
+
};
|
|
4224
|
+
});
|
|
4225
|
+
return $b8hua$createComponent((0, $bc2337c9a05ecd18$export$acb3eaade4b23afd), {
|
|
4226
|
+
get style() {
|
|
4227
|
+
return style();
|
|
4228
|
+
},
|
|
4229
|
+
get ["class"]() {
|
|
4230
|
+
return props.class;
|
|
4231
|
+
}
|
|
4232
|
+
});
|
|
4233
|
+
}
|
|
4234
|
+
const $ff7feae4dddd6073$var$_tmpl$ = ["<div", ' class="content-block-wrapper" style="', '">', "</div>"];
|
|
4235
|
+
function $ff7feae4dddd6073$export$791ef57e62e21c3f(_ref) {
|
|
4236
|
+
let {
|
|
4237
|
+
content_blocks_: incoming_content_blocks,
|
|
4238
|
+
cols_at_size_: cols_at_size_,
|
|
4239
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
4240
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4241
|
+
} = _ref;
|
|
4242
|
+
// these are by row
|
|
4243
|
+
const [content_blocks, set_content_blocks] = $b8hua$createStore([]);
|
|
4244
|
+
const n_cols_currently_showing_ = $8244fdad249f8d5f$export$a79e666719b3647c(cols_at_size_);
|
|
4245
|
+
const products_to_rows = products => {
|
|
4246
|
+
const cols_currently_showing = n_cols_currently_showing_();
|
|
4247
|
+
if (cols_currently_showing === null) return 0;
|
|
4248
|
+
return Math.ceil(products / cols_currently_showing);
|
|
4249
|
+
};
|
|
4250
|
+
const showing_rows = $b8hua$createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
4251
|
+
$b8hua$createEffect(() => {
|
|
4252
|
+
const incoming_value = incoming_content_blocks();
|
|
4253
|
+
if (!incoming_value) {
|
|
4254
|
+
set_content_blocks([]);
|
|
4255
|
+
return;
|
|
4256
|
+
}
|
|
4257
|
+
const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
|
|
4258
|
+
set_content_blocks($b8hua$reconcile(capped_value));
|
|
4259
|
+
});
|
|
4260
|
+
const get_wrapped_blocks_ = $ff7feae4dddd6073$var$wrap_blocks_in_div(content_blocks, n_cols_currently_showing_);
|
|
4261
|
+
$b8hua$createComputed(() => {
|
|
4262
|
+
// 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
|
|
4263
|
+
const top_row_block = get_wrapped_blocks_()[0];
|
|
4264
|
+
const blocks_in_top_row_taken = top_row_block === null || top_row_block === void 0 ? void 0 : top_row_block.span_columns;
|
|
4265
|
+
if (blocks_in_top_row_taken == undefined) {
|
|
4266
|
+
// Fall back to zero if no content block in top row, since then no blocks in top row are taken
|
|
4267
|
+
set_top_row_shortened_by_(0);
|
|
4268
|
+
return;
|
|
4269
|
+
}
|
|
4270
|
+
set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
|
|
4271
|
+
});
|
|
4272
|
+
|
|
4273
|
+
return $ff7feae4dddd6073$var$remap_blocks_to_index({
|
|
4274
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
4275
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
4276
|
+
});
|
|
4277
|
+
}
|
|
4278
|
+
/**
|
|
4279
|
+
* Calculate where to put each of the finished wrapped content blocks. Also limit blocks' max width.
|
|
4280
|
+
* @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
|
|
4281
|
+
*/
|
|
4282
|
+
function $ff7feae4dddd6073$var$remap_blocks_to_index(_ref2) {
|
|
4283
|
+
let {
|
|
4284
|
+
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
4285
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
4286
|
+
} = _ref2;
|
|
4287
|
+
return $b8hua$createMemo(() => {
|
|
4288
|
+
// This computation should be quite cheap since it just moves around things into an array
|
|
4289
|
+
const content_blocks_by_index = [];
|
|
4290
|
+
const constructed_block_arrays = new WeakSet();
|
|
4291
|
+
const wrapped_blocks = get_wrapped_blocks_();
|
|
4292
|
+
const cols_showing = n_cols_currently_showing_();
|
|
4293
|
+
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
4294
|
+
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
|
|
4295
|
+
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
4296
|
+
// i = row to show at
|
|
4297
|
+
const block = wrapped_blocks[i];
|
|
4298
|
+
if (!block) continue; // Array can have holes/not defined places
|
|
4299
|
+
const index_of_first_item_in_row = i * cols_showing;
|
|
4300
|
+
const index_of_last_item_in_row = index_of_first_item_in_row + cols_showing;
|
|
4301
|
+
const {
|
|
4302
|
+
span_rows: span_rows,
|
|
4303
|
+
position: position,
|
|
4304
|
+
span_columns: span_columns
|
|
4305
|
+
} = block; // span columns is already capped in the block wrapping step (wrap_blocks_in_div)
|
|
4306
|
+
let target_index;
|
|
4307
|
+
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));
|
|
4308
|
+
// Calculate displacement of us by content blocks above us
|
|
4309
|
+
let displacement_by_added_blocks = 0;
|
|
4310
|
+
for (let j = 0; j < i; j++) {
|
|
4311
|
+
const row = displaced_products[j];
|
|
4312
|
+
if (row === undefined) continue; // there were no blocks in this row
|
|
4313
|
+
let items_in_row;
|
|
4314
|
+
if (typeof row === "number") items_in_row = row;else {
|
|
4315
|
+
items_in_row = row.filter(item => item).length;
|
|
4316
|
+
displaced_products[j] = items_in_row;
|
|
4317
|
+
}
|
|
4318
|
+
displacement_by_added_blocks += items_in_row;
|
|
4319
|
+
}
|
|
4320
|
+
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
4321
|
+
for (let j = 0; j < index_of_us_in_row; j++) {
|
|
4322
|
+
var _displaced_products$i;
|
|
4323
|
+
if ((_displaced_products$i = displaced_products[i]) !== null && _displaced_products$i !== void 0 && _displaced_products$i[j])
|
|
4324
|
+
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
4325
|
+
displacement_by_added_blocks++;
|
|
4326
|
+
}
|
|
4327
|
+
// Add block to output array at the correct index
|
|
4328
|
+
const final_target_index = target_index - displacement_by_added_blocks;
|
|
4329
|
+
const existing_block = content_blocks_by_index[final_target_index];
|
|
4330
|
+
const block_content = block.content;
|
|
4331
|
+
// 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
|
|
4332
|
+
if (existing_block) {
|
|
4333
|
+
if (constructed_block_arrays.has(existing_block))
|
|
4334
|
+
// Only push to arrays we have created to not create funky bugs when there's an array in JSX.Element
|
|
4335
|
+
existing_block.push(block_content);else {
|
|
4336
|
+
const array = [existing_block, block_content];
|
|
4337
|
+
constructed_block_arrays.add(array);
|
|
4338
|
+
content_blocks_by_index[final_target_index] = array;
|
|
4339
|
+
}
|
|
4340
|
+
} else content_blocks_by_index[final_target_index] = block_content;
|
|
4341
|
+
// Update displacement
|
|
4342
|
+
for (let j = 0; j < span_rows; j++) {
|
|
4343
|
+
var _ref3;
|
|
4344
|
+
const row = displaced_products[_ref3 = i + j] || (displaced_products[_ref3] = []);
|
|
4345
|
+
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
4346
|
+
}
|
|
4347
|
+
}
|
|
4348
|
+
return content_blocks_by_index;
|
|
4349
|
+
});
|
|
4350
|
+
}
|
|
4351
|
+
/**
|
|
4352
|
+
* 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.
|
|
4353
|
+
* Then renders the content and wraps it into a div with the correct styling.
|
|
4354
|
+
* Also caps span_columns to max available columns
|
|
4355
|
+
*/
|
|
4356
|
+
function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
4357
|
+
const get_wrapped_blocks = $b8hua$mapArray(() => rendered_content_blocks, block => {
|
|
4358
|
+
if (!block) return;
|
|
4359
|
+
const get_span_columns = () => {
|
|
4360
|
+
var _max_span_columns;
|
|
4361
|
+
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
4362
|
+
};
|
|
4363
|
+
return $b8hua$mergeProps1(block, {
|
|
4364
|
+
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
4365
|
+
content: $b8hua$ssr($ff7feae4dddd6073$var$_tmpl$, $b8hua$ssrHydrationKey(), "grid-column:" + "span ".concat($b8hua$escape(get_span_columns(), true)) + (";grid-row:" + "span ".concat($b8hua$escape(block.span_rows, true))) + (";spans_columns_variable_name:" + $b8hua$escape(get_span_columns(), true)), $b8hua$escape($b8hua$createComponent($ff7feae4dddd6073$var$RenderContent, {
|
|
4366
|
+
get content() {
|
|
4367
|
+
return block.content;
|
|
4368
|
+
}
|
|
4369
|
+
}))),
|
|
4370
|
+
get span_columns() {
|
|
4371
|
+
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4372
|
+
return get_span_columns();
|
|
4373
|
+
}
|
|
4374
|
+
});
|
|
4375
|
+
});
|
|
4376
|
+
return get_wrapped_blocks;
|
|
4377
|
+
}
|
|
4378
|
+
/**
|
|
4379
|
+
* 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.
|
|
4380
|
+
*/
|
|
4381
|
+
function $ff7feae4dddd6073$var$RenderContent(props) {
|
|
4382
|
+
const [resource] = $b8hua$createResource(() => props.content,
|
|
4383
|
+
// Could be reactive
|
|
4384
|
+
fn => fn());
|
|
4385
|
+
$b8hua$createEffect(() => {
|
|
4386
|
+
if (resource.error) console.error("Error in content block rendering", resource.error);
|
|
4387
|
+
});
|
|
4388
|
+
// 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)
|
|
4389
|
+
return $b8hua$createComponent((0, $b8hua$Suspense), {
|
|
4390
|
+
get fallback() {
|
|
4391
|
+
return $b8hua$createComponent((0, $3ab4aa97880fb88d$export$3f37af283f8fb843), {
|
|
4392
|
+
width: "100%",
|
|
4393
|
+
height: "max(100%, 400px)"
|
|
4394
|
+
});
|
|
4395
|
+
},
|
|
4396
|
+
children: resource
|
|
4397
|
+
});
|
|
4398
|
+
}
|
|
4041
4399
|
const $7faea0096f14b59b$var$_tmpl$ = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"];
|
|
4042
4400
|
function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
4043
4401
|
let {
|
|
@@ -4054,7 +4412,8 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4054
4412
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
4055
4413
|
product_card_template_: product_card_template_,
|
|
4056
4414
|
layout_options_: layout_options_,
|
|
4057
|
-
id_currently_querying_for_: id_currently_querying_for_
|
|
4415
|
+
id_currently_querying_for_: id_currently_querying_for_,
|
|
4416
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
4058
4417
|
} = _ref;
|
|
4059
4418
|
// 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
|
|
4060
4419
|
const is_loading_ = $b8hua$createMemo(() => plp_results_.loading || query_base_.loading);
|
|
@@ -4097,24 +4456,37 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4097
4456
|
let is_just_after_plp_results_update = false;
|
|
4098
4457
|
let fallback_is_alive = false;
|
|
4099
4458
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $b8hua$createSignal(true);
|
|
4459
|
+
const [top_row_shortened_by_, set_top_row_shortened_by_] = $b8hua$createSignal(0);
|
|
4460
|
+
const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $b8hua$createSignal(false);
|
|
4461
|
+
const [number_loaded_displays, set_number_loaded_displays_] = $b8hua$createSignal(0);
|
|
4462
|
+
const modified_cols_at_size = $b2dbaafb23d00c7f$export$cb5808ba002cdeed({
|
|
4463
|
+
layout_options_: layout_options_,
|
|
4464
|
+
sort_or_filter_open_: sort_or_filter_open_
|
|
4465
|
+
});
|
|
4466
|
+
const num_placeholders_ = $b8hua$createMemo(() => {
|
|
4467
|
+
var _get_scroll_restorati, _get_scroll_restorati2;
|
|
4468
|
+
// 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
|
|
4469
|
+
return (0, $981356a8bf29ad72$export$6c9030e511152266) + ((_get_scroll_restorati = (_get_scroll_restorati2 = get_scroll_restoration_data().find(_ref2 => {
|
|
4470
|
+
let {
|
|
4471
|
+
for_id: for_id
|
|
4472
|
+
} = _ref2;
|
|
4473
|
+
return for_id === id_currently_querying_for_();
|
|
4474
|
+
})) === 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_);
|
|
4475
|
+
});
|
|
4476
|
+
const number_of_items_shown_ = $b8hua$createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
4477
|
+
const doesnt_have_content_blocks = $b8hua$createMemo(() => !content_blocks_by_row_());
|
|
4478
|
+
const content_blocks_ = $b8hua$createMemo(() => doesnt_have_content_blocks() ? () => [] : $ff7feae4dddd6073$export$791ef57e62e21c3f({
|
|
4479
|
+
content_blocks_: content_blocks_by_row_,
|
|
4480
|
+
cols_at_size_: modified_cols_at_size,
|
|
4481
|
+
number_of_items_shown_: number_of_items_shown_,
|
|
4482
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4483
|
+
}));
|
|
4100
4484
|
const rendered_placeholders = $b8hua$createMemo(() => get_should_have_placeholders_rendered() ? $bdd80c7862246dc2$export$f33414a4df0afd3f({
|
|
4485
|
+
content_blocks_: content_blocks_,
|
|
4101
4486
|
product_card_template_: product_card_template_,
|
|
4102
|
-
num_placeholders_:
|
|
4103
|
-
var _get_scroll_restorati, _get_scroll_restorati2;
|
|
4104
|
-
// 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
|
|
4105
|
-
return (0, $981356a8bf29ad72$export$6c9030e511152266) + ((_get_scroll_restorati = (_get_scroll_restorati2 = get_scroll_restoration_data().find(_ref2 => {
|
|
4106
|
-
let {
|
|
4107
|
-
for_id: for_id
|
|
4108
|
-
} = _ref2;
|
|
4109
|
-
return for_id === id_currently_querying_for_();
|
|
4110
|
-
})) === 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_);
|
|
4111
|
-
})
|
|
4487
|
+
num_placeholders_: num_placeholders_
|
|
4112
4488
|
}) : undefined);
|
|
4113
4489
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $b8hua$createSignal(false);
|
|
4114
|
-
const modified_cols_at_size = $7faea0096f14b59b$var$make_modified_cols_at_size({
|
|
4115
|
-
layout_options_: layout_options_,
|
|
4116
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
4117
|
-
});
|
|
4118
4490
|
const block_suspense_if_needed = () => {
|
|
4119
4491
|
if (!is_just_after_plp_results_update) return;
|
|
4120
4492
|
is_just_after_plp_results_update = false;
|
|
@@ -4147,6 +4519,8 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4147
4519
|
return (() => {
|
|
4148
4520
|
fallback_is_alive = true;
|
|
4149
4521
|
$b8hua$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4522
|
+
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
4523
|
+
$b8hua$onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
4150
4524
|
return $b8hua$createMemo(() => {
|
|
4151
4525
|
// 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
|
|
4152
4526
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -4171,37 +4545,64 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4171
4545
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
4172
4546
|
query_base_: query_base_,
|
|
4173
4547
|
depict_api_: depict_api_,
|
|
4174
|
-
is_loading_: is_loading_
|
|
4548
|
+
is_loading_: is_loading_,
|
|
4549
|
+
content_blocks_: content_blocks_,
|
|
4550
|
+
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4175
4551
|
});
|
|
4176
4552
|
$b8hua$onCleanup(() => suspense_contents = undefined);
|
|
4177
4553
|
return suspense_contents;
|
|
4178
4554
|
})();
|
|
4179
4555
|
}
|
|
4180
4556
|
});
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4557
|
+
/* 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 */
|
|
4558
|
+
const listing_contents = $b8hua$createComponent((0, $b8hua$Show), {
|
|
4559
|
+
get when() {
|
|
4560
|
+
return !is_loading_();
|
|
4184
4561
|
},
|
|
4185
|
-
get
|
|
4186
|
-
return
|
|
4562
|
+
get fallback() {
|
|
4563
|
+
return rendered_placeholders();
|
|
4187
4564
|
},
|
|
4188
|
-
|
|
4189
|
-
|
|
4565
|
+
children: product_cards_when_data
|
|
4566
|
+
});
|
|
4567
|
+
return [$ca55612a53dbbdd2$export$a2cc176055f8f08(), $b8hua$createComponent((0, $b8hua$Show), {
|
|
4568
|
+
get when() {
|
|
4569
|
+
return doesnt_have_content_blocks();
|
|
4190
4570
|
},
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4571
|
+
get fallback() {
|
|
4572
|
+
return $b8hua$createComponent((0, $64d94dcaa058dc7b$export$ab6b147eec64fea5), {
|
|
4573
|
+
get cols_at_size() {
|
|
4574
|
+
return modified_cols_at_size();
|
|
4575
|
+
},
|
|
4576
|
+
get override_vertical_spacing() {
|
|
4577
|
+
return layout_options_().override_vertical_spacing;
|
|
4578
|
+
},
|
|
4579
|
+
get grid_spacing() {
|
|
4580
|
+
return layout_options_().grid_spacing;
|
|
4581
|
+
},
|
|
4582
|
+
element_attributes: {
|
|
4583
|
+
class: "cards css-grid"
|
|
4584
|
+
},
|
|
4585
|
+
top_row_shortened_by_: top_row_shortened_by_,
|
|
4586
|
+
children: listing_contents
|
|
4587
|
+
});
|
|
4195
4588
|
},
|
|
4196
4589
|
get children() {
|
|
4197
|
-
return $b8hua$createComponent((0, $
|
|
4198
|
-
get
|
|
4199
|
-
return
|
|
4590
|
+
return $b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
|
|
4591
|
+
get cols_at_size() {
|
|
4592
|
+
return modified_cols_at_size();
|
|
4593
|
+
},
|
|
4594
|
+
get override_vertical_spacing() {
|
|
4595
|
+
return layout_options_().override_vertical_spacing;
|
|
4596
|
+
},
|
|
4597
|
+
get grid_spacing() {
|
|
4598
|
+
return layout_options_().grid_spacing;
|
|
4200
4599
|
},
|
|
4201
|
-
|
|
4202
|
-
|
|
4600
|
+
rows: "all",
|
|
4601
|
+
layout: "grid",
|
|
4602
|
+
element_attributes: {
|
|
4603
|
+
class: "cards"
|
|
4203
4604
|
},
|
|
4204
|
-
children:
|
|
4605
|
+
children: listing_contents
|
|
4205
4606
|
});
|
|
4206
4607
|
}
|
|
4207
4608
|
})];
|
|
@@ -4210,36 +4611,6 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4210
4611
|
}
|
|
4211
4612
|
})), $b8hua$escape(desktop_filter_elements_()));
|
|
4212
4613
|
}
|
|
4213
|
-
/**
|
|
4214
|
-
* Changes cols_at_size depending on if filters are open or not so one card less is shown when the filters are open
|
|
4215
|
-
* This function is special to the actual PLPResults.
|
|
4216
|
-
*/
|
|
4217
|
-
function $7faea0096f14b59b$var$make_modified_cols_at_size(_ref3) {
|
|
4218
|
-
let {
|
|
4219
|
-
layout_options_: layout_options_,
|
|
4220
|
-
sort_or_filter_open_: sort_or_filter_open_
|
|
4221
|
-
} = _ref3;
|
|
4222
|
-
return $b8hua$createMemo(() => {
|
|
4223
|
-
const layout_options = layout_options_();
|
|
4224
|
-
// Add grid styling that changes when filters get opened/closed
|
|
4225
|
-
const when_filters_closed_cols = layout_options.cols_at_size;
|
|
4226
|
-
return sort_or_filter_open_() ? when_filters_closed_cols.map(row => {
|
|
4227
|
-
const [num_cols_default,,,, override_cols] = row;
|
|
4228
|
-
const cloned_row = [...row];
|
|
4229
|
-
// @ts-ignore
|
|
4230
|
-
cloned_row[0] = num_cols_default - 1;
|
|
4231
|
-
if (override_cols)
|
|
4232
|
-
// @ts-ignore
|
|
4233
|
-
cloned_row[4] = {
|
|
4234
|
-
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(_ref4 => {
|
|
4235
|
-
let [row, column] = _ref4;
|
|
4236
|
-
return [row, column - 1];
|
|
4237
|
-
}))
|
|
4238
|
-
};
|
|
4239
|
-
return cloned_row;
|
|
4240
|
-
}) : when_filters_closed_cols;
|
|
4241
|
-
});
|
|
4242
|
-
}
|
|
4243
4614
|
const $cfdbd124dd09d713$var$_tmpl$ = ["<div", ' class="sorting-attributes">', "</div>"],
|
|
4244
4615
|
$cfdbd124dd09d713$var$_tmpl$2 = ["<div", ' class="sorting-direction">', "</div>"],
|
|
4245
4616
|
$cfdbd124dd09d713$var$_tmpl$3 = ["<div", '><div class="input-row"><input type="radio"', '><span class="custom-indicator"></span><!--#-->', "<!--/--></div></div>"],
|
|
@@ -5517,7 +5888,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
5517
5888
|
product_card_template_: product_card_template_,
|
|
5518
5889
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
5519
5890
|
sorting_query_param_: sorting_query_param_,
|
|
5520
|
-
filter_query_param_prefix_: filter_query_param_prefix_
|
|
5891
|
+
filter_query_param_prefix_: filter_query_param_prefix_,
|
|
5892
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
5521
5893
|
} = _ref;
|
|
5522
5894
|
let results_for;
|
|
5523
5895
|
let only_show_filters_opener_;
|
|
@@ -5793,6 +6165,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
5793
6165
|
product_card_template_: product_card_template_,
|
|
5794
6166
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
5795
6167
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
6168
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
5796
6169
|
id_currently_querying_for_: query_id_,
|
|
5797
6170
|
no_results_options_: {
|
|
5798
6171
|
selected_filters_: selected_filters_,
|
|
@@ -6399,6 +6772,7 @@ function $f5f54892fd0c7d9f$export$e2bf8ce7779e827e(props) {
|
|
|
6399
6772
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
6400
6773
|
selected_filters_: selected_filters_,
|
|
6401
6774
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
6775
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
6402
6776
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
6403
6777
|
layout_options_: $b8hua$createMemo(() => ({
|
|
6404
6778
|
cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77(props.cols_at_size),
|
|
@@ -6631,37 +7005,6 @@ async function $96fd967c5b358ead$var$download_categories(tenant, market, type) {
|
|
|
6631
7005
|
return [];
|
|
6632
7006
|
}
|
|
6633
7007
|
}
|
|
6634
|
-
function $3ab4aa97880fb88d$export$3f37af283f8fb843(props) {
|
|
6635
|
-
const style = $b8hua$createMemo(() => {
|
|
6636
|
-
const {
|
|
6637
|
-
style: style,
|
|
6638
|
-
height: height,
|
|
6639
|
-
width: width,
|
|
6640
|
-
aspectRatio: aspectRatio
|
|
6641
|
-
} = props;
|
|
6642
|
-
const is_image = aspectRatio != undefined;
|
|
6643
|
-
const size_data = is_image ? {
|
|
6644
|
-
width: "100%",
|
|
6645
|
-
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
6646
|
-
} : {
|
|
6647
|
-
width: width,
|
|
6648
|
-
height: height
|
|
6649
|
-
};
|
|
6650
|
-
return {
|
|
6651
|
-
display: "block",
|
|
6652
|
-
...(style || {}),
|
|
6653
|
-
...size_data
|
|
6654
|
-
};
|
|
6655
|
-
});
|
|
6656
|
-
return $b8hua$createComponent((0, $bc2337c9a05ecd18$export$acb3eaade4b23afd), {
|
|
6657
|
-
get style() {
|
|
6658
|
-
return style();
|
|
6659
|
-
},
|
|
6660
|
-
get ["class"]() {
|
|
6661
|
-
return props.class;
|
|
6662
|
-
}
|
|
6663
|
-
});
|
|
6664
|
-
}
|
|
6665
7008
|
const $5eaa00b951637e96$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>"];
|
|
6666
7009
|
function $5eaa00b951637e96$export$ee1733d9a8495996() {
|
|
6667
7010
|
return $b8hua$ssr($5eaa00b951637e96$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape($b8hua$createComponent((0, $3ab4aa97880fb88d$export$3f37af283f8fb843), {
|
|
@@ -8652,7 +8995,8 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
8652
8995
|
router_: router_,
|
|
8653
8996
|
content_results_rows_: content_results_rows_,
|
|
8654
8997
|
content_layout_options_: content_layout_options_,
|
|
8655
|
-
content_search_enabled_: content_search_enabled_
|
|
8998
|
+
content_search_enabled_: content_search_enabled_,
|
|
8999
|
+
content_blocks_by_row_: content_blocks_by_row_
|
|
8656
9000
|
} = _ref;
|
|
8657
9001
|
const [get_sorting] = current_sorting_;
|
|
8658
9002
|
const all_products_loaded_ = $b8hua$createSignal(false);
|
|
@@ -8918,6 +9262,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
8918
9262
|
layout_options_: layout_options_,
|
|
8919
9263
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
8920
9264
|
id_currently_querying_for_: get_search_query_,
|
|
9265
|
+
content_blocks_by_row_: content_blocks_by_row_,
|
|
8921
9266
|
no_results_options_: {
|
|
8922
9267
|
selected_filters_: selected_filters_,
|
|
8923
9268
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -9445,6 +9790,7 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
|
|
|
9445
9790
|
search_sorting_open_: state_.sorting_open,
|
|
9446
9791
|
expanded_filters_: state_.expanded_filters,
|
|
9447
9792
|
content_results_rows_: state_.content_results_rows,
|
|
9793
|
+
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
9448
9794
|
router_: shared_properties.router_,
|
|
9449
9795
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
9450
9796
|
return $dea31647b99a443b$export$d757d54550ebfb3d({
|