@depict-ai/ui 2.1.1 → 2.1.3
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 +33 -36
- package/ES10/index.d.ts +4 -4
- package/ES10/index.js +33 -36
- package/latest/index.cjs +33 -36
- package/latest/index.d.ts +4 -4
- package/latest/index.js +33 -36
- package/package.json +1 -1
- package/server/ES10/index.cjs +36 -37
- package/server/ES10/index.d.ts +4 -4
- package/server/ES10/index.js +36 -37
- package/server/latest/index.cjs +36 -37
- package/server/latest/index.d.ts +4 -4
- package/server/latest/index.js +36 -37
package/latest/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from
|
|
|
6
6
|
/*! Depict.ai search and product listing SDK */
|
|
7
7
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
8
8
|
register_es_version("ui", "latest");
|
|
9
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "2.1.
|
|
9
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "2.1.3";
|
|
10
10
|
const $4147651646da990a$var$fallback_operator = "in";
|
|
11
11
|
const $4147651646da990a$var$fallback_token = "";
|
|
12
12
|
const $4147651646da990a$var$legacy_filter_prefix = "filter_";
|
|
@@ -4568,8 +4568,7 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
4568
4568
|
query_base_: query_base_,
|
|
4569
4569
|
depict_api_: depict_api_,
|
|
4570
4570
|
is_loading_: is_loading_,
|
|
4571
|
-
content_blocks_: content_blocks_
|
|
4572
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4571
|
+
content_blocks_: content_blocks_
|
|
4573
4572
|
}) {
|
|
4574
4573
|
// 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
|
|
4575
4574
|
const target_to_index_map = new Map();
|
|
@@ -4613,7 +4612,6 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
4613
4612
|
query_base_: query_base_,
|
|
4614
4613
|
depict_api_: depict_api_
|
|
4615
4614
|
});
|
|
4616
|
-
$9HbP8$createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
4617
4615
|
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
4618
4616
|
displays_by_key_: displays_by_key_,
|
|
4619
4617
|
merchant_: merchant_,
|
|
@@ -4700,25 +4698,26 @@ function $6dee9211e57ac31a$var$generate_media_queried_declarations({
|
|
|
4700
4698
|
}) {
|
|
4701
4699
|
return cols_at_size_.map(options => {
|
|
4702
4700
|
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
4703
|
-
const
|
|
4701
|
+
const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
4704
4702
|
// See comment in else block below
|
|
4705
|
-
const can_use_gap = $6dee9211e57ac31a$var$can_use_gap_for_unit(
|
|
4703
|
+
const can_use_gap = override_vertical_spacing_ ? $6dee9211e57ac31a$var$can_use_gap_for_unit(override_vertical_spacing_) : $6dee9211e57ac31a$var$can_use_gap_for_unit(main_spacing_to_use);
|
|
4706
4704
|
let spacing_styling;
|
|
4707
4705
|
let additional_styling = ""; // outside the media query
|
|
4708
|
-
if (can_use_gap) spacing_styling = `gap:${
|
|
4706
|
+
if (can_use_gap) spacing_styling = `gap:${main_spacing_to_use};${override_vertical_spacing_ ? `row-gap:${override_vertical_spacing_};` : ``}`;else {
|
|
4709
4707
|
// 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)
|
|
4710
4708
|
// 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.
|
|
4711
4709
|
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
4712
4710
|
// 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.
|
|
4711
|
+
const vertical_spacing_to_use = override_vertical_spacing_ ?? main_spacing_to_use;
|
|
4713
4712
|
const width_multiplier = `var(${$6dee9211e57ac31a$export$c500183c31c2b22e}, 1)`; // How many cards wide the current item is (needed because content blocks)
|
|
4714
|
-
const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$6dee9211e57ac31a$var$strip_percent_unit(
|
|
4713
|
+
const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$6dee9211e57ac31a$var$strip_percent_unit(vertical_spacing_to_use)} / 2)) / ${n_cols}))`; // Width of one item in percent of the whole
|
|
4715
4714
|
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
4716
4715
|
const this_item_width_meat = `calc(${one_item_width_exclusing_gaps} * ${width_multiplier})`; // Width of just the card
|
|
4717
|
-
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$6dee9211e57ac31a$var$strip_percent_unit(
|
|
4716
|
+
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$6dee9211e57ac31a$var$strip_percent_unit(vertical_spacing_to_use)})`; // Width of the gaps
|
|
4718
4717
|
const this_item_width = `calc(${this_item_width_meat} + ${this_item_width_gaps})`; // Width of this item including gaps
|
|
4719
4718
|
// 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
|
|
4720
4719
|
const convert_top_spacing_to_item_width_percentage = spacing => `calc(calc(100 / ${this_item_width}) * ${spacing})`; // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
|
|
4721
|
-
spacing_styling = `column-gap:${
|
|
4720
|
+
spacing_styling = `column-gap:${main_spacing_to_use};`; // Still use gaps in the horizontal direction because that works flawlessly
|
|
4722
4721
|
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
4723
4722
|
additional_styling = $9HbP8$n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
|
|
4724
4723
|
}
|
|
@@ -4807,26 +4806,18 @@ const $e7a7eb102ddc0c79$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=co
|
|
|
4807
4806
|
function $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
|
|
4808
4807
|
content_blocks_: incoming_content_blocks,
|
|
4809
4808
|
cols_at_size_: cols_at_size_,
|
|
4810
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
4811
4809
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4812
4810
|
}) {
|
|
4813
4811
|
// these are by row
|
|
4814
4812
|
const [content_blocks, set_content_blocks] = $9HbP8$createStore([]);
|
|
4815
4813
|
const n_cols_currently_showing_ = $bed740eef1769419$export$a79e666719b3647c(cols_at_size_);
|
|
4816
|
-
const products_to_rows = products => {
|
|
4817
|
-
const cols_currently_showing = n_cols_currently_showing_();
|
|
4818
|
-
if (cols_currently_showing === null) return 0;
|
|
4819
|
-
return Math.ceil(products / cols_currently_showing);
|
|
4820
|
-
};
|
|
4821
|
-
const showing_rows = $9HbP8$createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
4822
4814
|
$9HbP8$createEffect(() => {
|
|
4823
4815
|
const incoming_value = incoming_content_blocks();
|
|
4824
4816
|
if (!incoming_value) {
|
|
4825
4817
|
set_content_blocks([]);
|
|
4826
4818
|
return;
|
|
4827
4819
|
}
|
|
4828
|
-
|
|
4829
|
-
set_content_blocks($9HbP8$reconcile(capped_value, {
|
|
4820
|
+
set_content_blocks($9HbP8$reconcile(incoming_value, {
|
|
4830
4821
|
key: "content"
|
|
4831
4822
|
})); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
|
|
4832
4823
|
});
|
|
@@ -4883,12 +4874,12 @@ function $e7a7eb102ddc0c79$var$remap_blocks_to_index({
|
|
|
4883
4874
|
for (let j = 0; j < i; j++) {
|
|
4884
4875
|
const row = displaced_products[j];
|
|
4885
4876
|
if (row === undefined) continue; // there were no blocks in this row
|
|
4886
|
-
let
|
|
4887
|
-
if (typeof row === "number")
|
|
4888
|
-
|
|
4889
|
-
displaced_products[j] =
|
|
4877
|
+
let displaced_items_in_row;
|
|
4878
|
+
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
4879
|
+
displaced_items_in_row = row.filter(item => item).length;
|
|
4880
|
+
displaced_products[j] = displaced_items_in_row;
|
|
4890
4881
|
}
|
|
4891
|
-
displacement_by_added_blocks +=
|
|
4882
|
+
displacement_by_added_blocks += displaced_items_in_row;
|
|
4892
4883
|
}
|
|
4893
4884
|
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
4894
4885
|
for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products[i]?.[j])
|
|
@@ -4926,9 +4917,12 @@ function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4926
4917
|
const get_wrapped_blocks = $9HbP8$mapArray(() => rendered_content_blocks, block => {
|
|
4927
4918
|
if (!block) return;
|
|
4928
4919
|
const get_span_columns = () => Math.min(block.span_columns, max_span_columns() ?? Infinity);
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4920
|
+
const [rendering_delayed, set_rendering_delayed_] = $9HbP8$createSignal(true);
|
|
4921
|
+
const content = $9HbP8$createComponent((0, $9HbP8$Show), {
|
|
4922
|
+
get when() {
|
|
4923
|
+
return !rendering_delayed();
|
|
4924
|
+
},
|
|
4925
|
+
get children() {
|
|
4932
4926
|
const _el$ = $9HbP8$getNextElement($e7a7eb102ddc0c79$var$_tmpl$);
|
|
4933
4927
|
$9HbP8$insert(_el$, $9HbP8$createComponent($e7a7eb102ddc0c79$var$RenderContent, {
|
|
4934
4928
|
get content() {
|
|
@@ -4951,7 +4945,16 @@ function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4951
4945
|
_v$3: undefined
|
|
4952
4946
|
});
|
|
4953
4947
|
return _el$;
|
|
4954
|
-
}
|
|
4948
|
+
}
|
|
4949
|
+
});
|
|
4950
|
+
return $9HbP8$mergeProps1(block, {
|
|
4951
|
+
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
4952
|
+
content: () => {
|
|
4953
|
+
// Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
|
|
4954
|
+
// However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
|
|
4955
|
+
set_rendering_delayed_(false);
|
|
4956
|
+
return content;
|
|
4957
|
+
},
|
|
4955
4958
|
get span_columns() {
|
|
4956
4959
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4957
4960
|
return get_span_columns();
|
|
@@ -5045,8 +5048,7 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
5045
5048
|
let fallback_is_alive = false;
|
|
5046
5049
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $9HbP8$createSignal(true);
|
|
5047
5050
|
const [top_row_shortened_by_, set_top_row_shortened_by_] = $9HbP8$createSignal(0);
|
|
5048
|
-
|
|
5049
|
-
const [number_loaded_displays, set_number_loaded_displays_] = $9HbP8$createSignal(0);
|
|
5051
|
+
$9HbP8$createSignal(false);
|
|
5050
5052
|
const modified_cols_at_size = $15aa76e6da02e5c2$export$cb5808ba002cdeed({
|
|
5051
5053
|
layout_options_: layout_options_,
|
|
5052
5054
|
sort_or_filter_open_: sort_or_filter_open_
|
|
@@ -5057,12 +5059,10 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
5057
5059
|
for_id: for_id
|
|
5058
5060
|
}) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
|
|
5059
5061
|
});
|
|
5060
|
-
const number_of_items_shown_ = $9HbP8$createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
5061
5062
|
const doesnt_have_content_blocks = $9HbP8$createMemo(() => !content_blocks_by_row_());
|
|
5062
5063
|
const content_blocks_ = $9HbP8$createMemo(() => doesnt_have_content_blocks() ? () => [] : $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
|
|
5063
5064
|
content_blocks_: content_blocks_by_row_,
|
|
5064
5065
|
cols_at_size_: modified_cols_at_size,
|
|
5065
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
5066
5066
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
5067
5067
|
}));
|
|
5068
5068
|
const rendered_placeholders = $9HbP8$createMemo(() => get_should_have_placeholders_rendered() ? $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
@@ -5102,8 +5102,6 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
5102
5102
|
get fallback() {
|
|
5103
5103
|
fallback_is_alive = true;
|
|
5104
5104
|
$9HbP8$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
5105
|
-
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
5106
|
-
$9HbP8$onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
5107
5105
|
return $9HbP8$createMemo(() => {
|
|
5108
5106
|
// 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
|
|
5109
5107
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -5128,8 +5126,7 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
5128
5126
|
query_base_: query_base_,
|
|
5129
5127
|
depict_api_: depict_api_,
|
|
5130
5128
|
is_loading_: is_loading_,
|
|
5131
|
-
content_blocks_: content_blocks_
|
|
5132
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
5129
|
+
content_blocks_: content_blocks_
|
|
5133
5130
|
});
|
|
5134
5131
|
$9HbP8$onCleanup(() => suspense_contents = undefined);
|
|
5135
5132
|
return suspense_contents;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
|
|
5
5
|
"packageManager": "yarn@3.2.2",
|
|
6
6
|
"sass": "styles.scss",
|
package/server/ES10/index.cjs
CHANGED
|
@@ -76,7 +76,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
|
|
|
76
76
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
|
|
77
77
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
78
78
|
/*! Depict.ai search and product listing SDK */
|
|
79
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.
|
|
79
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.3";
|
|
80
80
|
const $a68b73fd7ba0853f$var$fallback_operator = "in";
|
|
81
81
|
const $a68b73fd7ba0853f$var$fallback_token = "";
|
|
82
82
|
const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
|
|
@@ -4056,8 +4056,7 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
4056
4056
|
query_base_: query_base_,
|
|
4057
4057
|
depict_api_: depict_api_,
|
|
4058
4058
|
is_loading_: is_loading_,
|
|
4059
|
-
content_blocks_: content_blocks_
|
|
4060
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4059
|
+
content_blocks_: content_blocks_
|
|
4061
4060
|
} = _ref;
|
|
4062
4061
|
// 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
|
|
4063
4062
|
const target_to_index_map = new Map();
|
|
@@ -4104,7 +4103,6 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
4104
4103
|
query_base_: query_base_,
|
|
4105
4104
|
depict_api_: depict_api_
|
|
4106
4105
|
});
|
|
4107
|
-
$3hooq$solidjs.createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
4108
4106
|
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
4109
4107
|
displays_by_key_: displays_by_key_,
|
|
4110
4108
|
merchant_: merchant_,
|
|
@@ -4183,25 +4181,26 @@ function $830518481649feb1$var$generate_media_queried_declarations(_ref) {
|
|
|
4183
4181
|
} = _ref;
|
|
4184
4182
|
return cols_at_size_.map(options => {
|
|
4185
4183
|
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
4186
|
-
const
|
|
4184
|
+
const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
4187
4185
|
// See comment in else block below
|
|
4188
|
-
const can_use_gap = $830518481649feb1$var$can_use_gap_for_unit(
|
|
4186
|
+
const can_use_gap = override_vertical_spacing_ ? $830518481649feb1$var$can_use_gap_for_unit(override_vertical_spacing_) : $830518481649feb1$var$can_use_gap_for_unit(main_spacing_to_use);
|
|
4189
4187
|
let spacing_styling;
|
|
4190
4188
|
let additional_styling = ""; // outside the media query
|
|
4191
|
-
if (can_use_gap) spacing_styling = "gap:".concat(
|
|
4189
|
+
if (can_use_gap) spacing_styling = "gap:".concat(main_spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
|
|
4192
4190
|
// 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)
|
|
4193
4191
|
// 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.
|
|
4194
4192
|
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
4195
4193
|
// 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.
|
|
4194
|
+
const vertical_spacing_to_use = override_vertical_spacing_ !== null && override_vertical_spacing_ !== void 0 ? override_vertical_spacing_ : main_spacing_to_use;
|
|
4196
4195
|
const width_multiplier = "var(".concat($830518481649feb1$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
|
|
4197
|
-
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(
|
|
4196
|
+
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(vertical_spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
|
|
4198
4197
|
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
4199
4198
|
const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
|
|
4200
|
-
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($830518481649feb1$var$strip_percent_unit(
|
|
4199
|
+
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($830518481649feb1$var$strip_percent_unit(vertical_spacing_to_use), ")"); // Width of the gaps
|
|
4201
4200
|
const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
|
|
4202
4201
|
// 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
|
|
4203
4202
|
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)
|
|
4204
|
-
spacing_styling = "column-gap:".concat(
|
|
4203
|
+
spacing_styling = "column-gap:".concat(main_spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
|
|
4205
4204
|
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
4206
4205
|
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_);
|
|
4207
4206
|
}
|
|
@@ -4299,26 +4298,18 @@ function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
|
|
|
4299
4298
|
let {
|
|
4300
4299
|
content_blocks_: incoming_content_blocks,
|
|
4301
4300
|
cols_at_size_: cols_at_size_,
|
|
4302
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
4303
4301
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4304
4302
|
} = _ref;
|
|
4305
4303
|
// these are by row
|
|
4306
4304
|
const [content_blocks, set_content_blocks] = $3hooq$solidjsstore.createStore([]);
|
|
4307
4305
|
const n_cols_currently_showing_ = $85fcdab554c24789$export$a79e666719b3647c(cols_at_size_);
|
|
4308
|
-
const products_to_rows = products => {
|
|
4309
|
-
const cols_currently_showing = n_cols_currently_showing_();
|
|
4310
|
-
if (cols_currently_showing === null) return 0;
|
|
4311
|
-
return Math.ceil(products / cols_currently_showing);
|
|
4312
|
-
};
|
|
4313
|
-
const showing_rows = $3hooq$solidjs.createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
4314
4306
|
$3hooq$solidjs.createEffect(() => {
|
|
4315
4307
|
const incoming_value = incoming_content_blocks();
|
|
4316
4308
|
if (!incoming_value) {
|
|
4317
4309
|
set_content_blocks([]);
|
|
4318
4310
|
return;
|
|
4319
4311
|
}
|
|
4320
|
-
|
|
4321
|
-
set_content_blocks($3hooq$solidjsstore.reconcile(capped_value, {
|
|
4312
|
+
set_content_blocks($3hooq$solidjsstore.reconcile(incoming_value, {
|
|
4322
4313
|
key: "content"
|
|
4323
4314
|
})); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
|
|
4324
4315
|
});
|
|
@@ -4376,12 +4367,12 @@ function $f8f375d6245ffff2$var$remap_blocks_to_index(_ref2) {
|
|
|
4376
4367
|
for (let j = 0; j < i; j++) {
|
|
4377
4368
|
const row = displaced_products[j];
|
|
4378
4369
|
if (row === undefined) continue; // there were no blocks in this row
|
|
4379
|
-
let
|
|
4380
|
-
if (typeof row === "number")
|
|
4381
|
-
|
|
4382
|
-
displaced_products[j] =
|
|
4370
|
+
let displaced_items_in_row;
|
|
4371
|
+
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
4372
|
+
displaced_items_in_row = row.filter(item => item).length;
|
|
4373
|
+
displaced_products[j] = displaced_items_in_row;
|
|
4383
4374
|
}
|
|
4384
|
-
displacement_by_added_blocks +=
|
|
4375
|
+
displacement_by_added_blocks += displaced_items_in_row;
|
|
4385
4376
|
}
|
|
4386
4377
|
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
4387
4378
|
for (let j = 0; j < index_of_us_in_row; j++) {
|
|
@@ -4426,13 +4417,27 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4426
4417
|
var _max_span_columns;
|
|
4427
4418
|
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
4428
4419
|
};
|
|
4420
|
+
const [rendering_delayed, set_rendering_delayed_] = $3hooq$solidjs.createSignal(true);
|
|
4421
|
+
const content = $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
4422
|
+
get when() {
|
|
4423
|
+
return !rendering_delayed();
|
|
4424
|
+
},
|
|
4425
|
+
get children() {
|
|
4426
|
+
return $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, {
|
|
4427
|
+
get content() {
|
|
4428
|
+
return block.content;
|
|
4429
|
+
}
|
|
4430
|
+
})));
|
|
4431
|
+
}
|
|
4432
|
+
});
|
|
4429
4433
|
return $3hooq$solidjs.mergeProps(block, {
|
|
4430
4434
|
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
4431
|
-
content:
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4435
|
+
content: () => {
|
|
4436
|
+
// Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
|
|
4437
|
+
// However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
|
|
4438
|
+
set_rendering_delayed_(false);
|
|
4439
|
+
return content;
|
|
4440
|
+
},
|
|
4436
4441
|
get span_columns() {
|
|
4437
4442
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4438
4443
|
return get_span_columns();
|
|
@@ -4523,8 +4528,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4523
4528
|
let fallback_is_alive = false;
|
|
4524
4529
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $3hooq$solidjs.createSignal(true);
|
|
4525
4530
|
const [top_row_shortened_by_, set_top_row_shortened_by_] = $3hooq$solidjs.createSignal(0);
|
|
4526
|
-
|
|
4527
|
-
const [number_loaded_displays, set_number_loaded_displays_] = $3hooq$solidjs.createSignal(0);
|
|
4531
|
+
$3hooq$solidjs.createSignal(false);
|
|
4528
4532
|
const modified_cols_at_size = $c749e60bca5000cb$export$cb5808ba002cdeed({
|
|
4529
4533
|
layout_options_: layout_options_,
|
|
4530
4534
|
sort_or_filter_open_: sort_or_filter_open_
|
|
@@ -4539,12 +4543,10 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4539
4543
|
return for_id === id_currently_querying_for_();
|
|
4540
4544
|
})) === 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_);
|
|
4541
4545
|
});
|
|
4542
|
-
const number_of_items_shown_ = $3hooq$solidjs.createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
4543
4546
|
const doesnt_have_content_blocks = $3hooq$solidjs.createMemo(() => !content_blocks_by_row_());
|
|
4544
4547
|
const content_blocks_ = $3hooq$solidjs.createMemo(() => doesnt_have_content_blocks() ? () => [] : $f8f375d6245ffff2$export$791ef57e62e21c3f({
|
|
4545
4548
|
content_blocks_: content_blocks_by_row_,
|
|
4546
4549
|
cols_at_size_: modified_cols_at_size,
|
|
4547
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
4548
4550
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4549
4551
|
}));
|
|
4550
4552
|
const rendered_placeholders = $3hooq$solidjs.createMemo(() => get_should_have_placeholders_rendered() ? $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
@@ -4584,8 +4586,6 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4584
4586
|
get fallback() {
|
|
4585
4587
|
fallback_is_alive = true;
|
|
4586
4588
|
$3hooq$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4587
|
-
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
4588
|
-
$3hooq$solidjs.onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
4589
4589
|
return $3hooq$solidjs.createMemo(() => {
|
|
4590
4590
|
// 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
|
|
4591
4591
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -4610,8 +4610,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4610
4610
|
query_base_: query_base_,
|
|
4611
4611
|
depict_api_: depict_api_,
|
|
4612
4612
|
is_loading_: is_loading_,
|
|
4613
|
-
content_blocks_: content_blocks_
|
|
4614
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4613
|
+
content_blocks_: content_blocks_
|
|
4615
4614
|
});
|
|
4616
4615
|
$3hooq$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
4617
4616
|
return suspense_contents;
|
package/server/ES10/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { BaseCategoryDisplay, ProductListingResponse } from "@depict-ai/types/ap
|
|
|
6
6
|
import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/api/SearchSuggestionsResponse";
|
|
7
7
|
import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
|
|
8
8
|
import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
|
|
9
|
-
import {
|
|
10
|
-
export const version = "2.1.
|
|
9
|
+
import { ProductListingRequestV2 } from "@depict-ai/types/api/ProductListingRequestV2";
|
|
10
|
+
export const version = "2.1.3";
|
|
11
11
|
/**
|
|
12
12
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
13
13
|
*/
|
|
@@ -55,7 +55,7 @@ export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlac
|
|
|
55
55
|
* The interface for a content block.
|
|
56
56
|
* Please make sure that you don't have content blocks overlap as that will cause undefined behavior.
|
|
57
57
|
* The height of the content block will be the height of the tallest item in a row, so if there are no products in a row the content block needs to "bring its own height".
|
|
58
|
-
* If you need to load any data in the content block, please make sure to return a placeholder while you're doing so, to avoid layout shifts and ensure scroll restoration works correctly.
|
|
58
|
+
* If you need to load any data in the content block, please make sure to return a placeholder while you're doing so (see `ImagePlaceholder`), to avoid layout shifts and ensure scroll restoration works correctly.
|
|
59
59
|
*
|
|
60
60
|
* - `span_columns`: How many columns the block should span. This will be capped to the number of columns available.
|
|
61
61
|
* - `span_rows`: How many rows the block should span.
|
|
@@ -670,7 +670,7 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
|
|
|
670
670
|
query(input_req: SearchRequest): Promise<SearchResponseAfterURLCreator & {
|
|
671
671
|
failed?: true;
|
|
672
672
|
}>;
|
|
673
|
-
list(input_req:
|
|
673
|
+
list(input_req: ProductListingRequestV2): Promise<ProductListingResponseAfterURLCreator & {
|
|
674
674
|
failed?: true;
|
|
675
675
|
}>;
|
|
676
676
|
get_recommended<T extends Display>(input_req: BaseSearchRequest): Promise<{
|
package/server/ES10/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createStore as $b8hua$createStore, reconcile as $b8hua$reconcile } from
|
|
|
9
9
|
/*! Depict.ai search and product listing SDK */
|
|
10
10
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
11
11
|
register_es_version("ui", "ES10");
|
|
12
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.
|
|
12
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.3";
|
|
13
13
|
const $2855bffe06ef7a03$var$fallback_operator = "in";
|
|
14
14
|
const $2855bffe06ef7a03$var$fallback_token = "";
|
|
15
15
|
const $2855bffe06ef7a03$var$legacy_filter_prefix = "filter_";
|
|
@@ -3989,8 +3989,7 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
3989
3989
|
query_base_: query_base_,
|
|
3990
3990
|
depict_api_: depict_api_,
|
|
3991
3991
|
is_loading_: is_loading_,
|
|
3992
|
-
content_blocks_: content_blocks_
|
|
3993
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
3992
|
+
content_blocks_: content_blocks_
|
|
3994
3993
|
} = _ref;
|
|
3995
3994
|
// 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
|
|
3996
3995
|
const target_to_index_map = new Map();
|
|
@@ -4037,7 +4036,6 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
4037
4036
|
query_base_: query_base_,
|
|
4038
4037
|
depict_api_: depict_api_
|
|
4039
4038
|
});
|
|
4040
|
-
$b8hua$createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
4041
4039
|
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
4042
4040
|
displays_by_key_: displays_by_key_,
|
|
4043
4041
|
merchant_: merchant_,
|
|
@@ -4116,25 +4114,26 @@ function $64d94dcaa058dc7b$var$generate_media_queried_declarations(_ref) {
|
|
|
4116
4114
|
} = _ref;
|
|
4117
4115
|
return cols_at_size_.map(options => {
|
|
4118
4116
|
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
4119
|
-
const
|
|
4117
|
+
const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
4120
4118
|
// See comment in else block below
|
|
4121
|
-
const can_use_gap = $64d94dcaa058dc7b$var$can_use_gap_for_unit(
|
|
4119
|
+
const can_use_gap = override_vertical_spacing_ ? $64d94dcaa058dc7b$var$can_use_gap_for_unit(override_vertical_spacing_) : $64d94dcaa058dc7b$var$can_use_gap_for_unit(main_spacing_to_use);
|
|
4122
4120
|
let spacing_styling;
|
|
4123
4121
|
let additional_styling = ""; // outside the media query
|
|
4124
|
-
if (can_use_gap) spacing_styling = "gap:".concat(
|
|
4122
|
+
if (can_use_gap) spacing_styling = "gap:".concat(main_spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
|
|
4125
4123
|
// 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)
|
|
4126
4124
|
// 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.
|
|
4127
4125
|
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
4128
4126
|
// 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.
|
|
4127
|
+
const vertical_spacing_to_use = override_vertical_spacing_ !== null && override_vertical_spacing_ !== void 0 ? override_vertical_spacing_ : main_spacing_to_use;
|
|
4129
4128
|
const width_multiplier = "var(".concat($64d94dcaa058dc7b$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
|
|
4130
|
-
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(
|
|
4129
|
+
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(vertical_spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
|
|
4131
4130
|
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
4132
4131
|
const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
|
|
4133
|
-
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($64d94dcaa058dc7b$var$strip_percent_unit(
|
|
4132
|
+
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($64d94dcaa058dc7b$var$strip_percent_unit(vertical_spacing_to_use), ")"); // Width of the gaps
|
|
4134
4133
|
const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
|
|
4135
4134
|
// 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
|
|
4136
4135
|
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)
|
|
4137
|
-
spacing_styling = "column-gap:".concat(
|
|
4136
|
+
spacing_styling = "column-gap:".concat(main_spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
|
|
4138
4137
|
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
4139
4138
|
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_);
|
|
4140
4139
|
}
|
|
@@ -4232,26 +4231,18 @@ function $ff7feae4dddd6073$export$791ef57e62e21c3f(_ref) {
|
|
|
4232
4231
|
let {
|
|
4233
4232
|
content_blocks_: incoming_content_blocks,
|
|
4234
4233
|
cols_at_size_: cols_at_size_,
|
|
4235
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
4236
4234
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4237
4235
|
} = _ref;
|
|
4238
4236
|
// these are by row
|
|
4239
4237
|
const [content_blocks, set_content_blocks] = $b8hua$createStore([]);
|
|
4240
4238
|
const n_cols_currently_showing_ = $8244fdad249f8d5f$export$a79e666719b3647c(cols_at_size_);
|
|
4241
|
-
const products_to_rows = products => {
|
|
4242
|
-
const cols_currently_showing = n_cols_currently_showing_();
|
|
4243
|
-
if (cols_currently_showing === null) return 0;
|
|
4244
|
-
return Math.ceil(products / cols_currently_showing);
|
|
4245
|
-
};
|
|
4246
|
-
const showing_rows = $b8hua$createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
4247
4239
|
$b8hua$createEffect(() => {
|
|
4248
4240
|
const incoming_value = incoming_content_blocks();
|
|
4249
4241
|
if (!incoming_value) {
|
|
4250
4242
|
set_content_blocks([]);
|
|
4251
4243
|
return;
|
|
4252
4244
|
}
|
|
4253
|
-
|
|
4254
|
-
set_content_blocks($b8hua$reconcile(capped_value, {
|
|
4245
|
+
set_content_blocks($b8hua$reconcile(incoming_value, {
|
|
4255
4246
|
key: "content"
|
|
4256
4247
|
})); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
|
|
4257
4248
|
});
|
|
@@ -4309,12 +4300,12 @@ function $ff7feae4dddd6073$var$remap_blocks_to_index(_ref2) {
|
|
|
4309
4300
|
for (let j = 0; j < i; j++) {
|
|
4310
4301
|
const row = displaced_products[j];
|
|
4311
4302
|
if (row === undefined) continue; // there were no blocks in this row
|
|
4312
|
-
let
|
|
4313
|
-
if (typeof row === "number")
|
|
4314
|
-
|
|
4315
|
-
displaced_products[j] =
|
|
4303
|
+
let displaced_items_in_row;
|
|
4304
|
+
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
4305
|
+
displaced_items_in_row = row.filter(item => item).length;
|
|
4306
|
+
displaced_products[j] = displaced_items_in_row;
|
|
4316
4307
|
}
|
|
4317
|
-
displacement_by_added_blocks +=
|
|
4308
|
+
displacement_by_added_blocks += displaced_items_in_row;
|
|
4318
4309
|
}
|
|
4319
4310
|
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
4320
4311
|
for (let j = 0; j < index_of_us_in_row; j++) {
|
|
@@ -4359,13 +4350,27 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4359
4350
|
var _max_span_columns;
|
|
4360
4351
|
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
4361
4352
|
};
|
|
4353
|
+
const [rendering_delayed, set_rendering_delayed_] = $b8hua$createSignal(true);
|
|
4354
|
+
const content = $b8hua$createComponent((0, $b8hua$Show), {
|
|
4355
|
+
get when() {
|
|
4356
|
+
return !rendering_delayed();
|
|
4357
|
+
},
|
|
4358
|
+
get children() {
|
|
4359
|
+
return $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, {
|
|
4360
|
+
get content() {
|
|
4361
|
+
return block.content;
|
|
4362
|
+
}
|
|
4363
|
+
})));
|
|
4364
|
+
}
|
|
4365
|
+
});
|
|
4362
4366
|
return $b8hua$mergeProps1(block, {
|
|
4363
4367
|
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
4364
|
-
content:
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4368
|
+
content: () => {
|
|
4369
|
+
// Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
|
|
4370
|
+
// However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
|
|
4371
|
+
set_rendering_delayed_(false);
|
|
4372
|
+
return content;
|
|
4373
|
+
},
|
|
4369
4374
|
get span_columns() {
|
|
4370
4375
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4371
4376
|
return get_span_columns();
|
|
@@ -4456,8 +4461,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4456
4461
|
let fallback_is_alive = false;
|
|
4457
4462
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $b8hua$createSignal(true);
|
|
4458
4463
|
const [top_row_shortened_by_, set_top_row_shortened_by_] = $b8hua$createSignal(0);
|
|
4459
|
-
|
|
4460
|
-
const [number_loaded_displays, set_number_loaded_displays_] = $b8hua$createSignal(0);
|
|
4464
|
+
$b8hua$createSignal(false);
|
|
4461
4465
|
const modified_cols_at_size = $b2dbaafb23d00c7f$export$cb5808ba002cdeed({
|
|
4462
4466
|
layout_options_: layout_options_,
|
|
4463
4467
|
sort_or_filter_open_: sort_or_filter_open_
|
|
@@ -4472,12 +4476,10 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4472
4476
|
return for_id === id_currently_querying_for_();
|
|
4473
4477
|
})) === 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_);
|
|
4474
4478
|
});
|
|
4475
|
-
const number_of_items_shown_ = $b8hua$createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
4476
4479
|
const doesnt_have_content_blocks = $b8hua$createMemo(() => !content_blocks_by_row_());
|
|
4477
4480
|
const content_blocks_ = $b8hua$createMemo(() => doesnt_have_content_blocks() ? () => [] : $ff7feae4dddd6073$export$791ef57e62e21c3f({
|
|
4478
4481
|
content_blocks_: content_blocks_by_row_,
|
|
4479
4482
|
cols_at_size_: modified_cols_at_size,
|
|
4480
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
4481
4483
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4482
4484
|
}));
|
|
4483
4485
|
const rendered_placeholders = $b8hua$createMemo(() => get_should_have_placeholders_rendered() ? $bdd80c7862246dc2$export$f33414a4df0afd3f({
|
|
@@ -4517,8 +4519,6 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4517
4519
|
get fallback() {
|
|
4518
4520
|
fallback_is_alive = true;
|
|
4519
4521
|
$b8hua$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4520
|
-
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
4521
|
-
$b8hua$onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
4522
4522
|
return $b8hua$createMemo(() => {
|
|
4523
4523
|
// 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
|
|
4524
4524
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -4543,8 +4543,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4543
4543
|
query_base_: query_base_,
|
|
4544
4544
|
depict_api_: depict_api_,
|
|
4545
4545
|
is_loading_: is_loading_,
|
|
4546
|
-
content_blocks_: content_blocks_
|
|
4547
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4546
|
+
content_blocks_: content_blocks_
|
|
4548
4547
|
});
|
|
4549
4548
|
$b8hua$onCleanup(() => suspense_contents = undefined);
|
|
4550
4549
|
return suspense_contents;
|