@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 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.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_";
@@ -4970,8 +4970,7 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
4970
4970
  query_base_: query_base_,
4971
4971
  depict_api_: depict_api_,
4972
4972
  is_loading_: is_loading_,
4973
- content_blocks_: content_blocks_,
4974
- set_number_loaded_displays_: set_number_loaded_displays_
4973
+ content_blocks_: content_blocks_
4975
4974
  } = _ref;
4976
4975
  // 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
4977
4976
  const target_to_index_map = new Map();
@@ -5018,7 +5017,6 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
5018
5017
  query_base_: query_base_,
5019
5018
  depict_api_: depict_api_
5020
5019
  });
5021
- $52FdA$solidjs.createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
5022
5020
  return $76012c4468a53d1f$export$43f0fb951fcb0c54({
5023
5021
  displays_by_key_: displays_by_key_,
5024
5022
  merchant_: merchant_,
@@ -5108,25 +5106,26 @@ function $830518481649feb1$var$generate_media_queried_declarations(_ref) {
5108
5106
  } = _ref;
5109
5107
  return cols_at_size_.map(options => {
5110
5108
  const [n_cols, min, max, grid_spacing_for_size] = options;
5111
- const spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
5109
+ const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
5112
5110
  // See comment in else block below
5113
- const can_use_gap = $830518481649feb1$var$can_use_gap_for_unit(spacing_to_use) && (!override_vertical_spacing_ || $830518481649feb1$var$can_use_gap_for_unit(override_vertical_spacing_));
5111
+ 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);
5114
5112
  let spacing_styling;
5115
5113
  let additional_styling = ""; // outside the media query
5116
- if (can_use_gap) spacing_styling = "gap:".concat(spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
5114
+ if (can_use_gap) spacing_styling = "gap:".concat(main_spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
5117
5115
  // 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)
5118
5116
  // 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.
5119
5117
  // Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
5120
5118
  // 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.
5119
+ const vertical_spacing_to_use = override_vertical_spacing_ !== null && override_vertical_spacing_ !== void 0 ? override_vertical_spacing_ : main_spacing_to_use;
5121
5120
  const width_multiplier = "var(".concat($830518481649feb1$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
5122
- const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($830518481649feb1$var$strip_percent_unit(spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
5121
+ 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
5123
5122
  // Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
5124
5123
  const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
5125
- const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($830518481649feb1$var$strip_percent_unit(spacing_to_use), ")"); // Width of the gaps
5124
+ 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
5126
5125
  const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
5127
5126
  // 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
5128
5127
  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)
5129
- spacing_styling = "column-gap:".concat(spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
5128
+ spacing_styling = "column-gap:".concat(main_spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
5130
5129
  // Re-use old layout code to get the correct :nth-child declarations for the top margins
5131
5130
  additional_styling = $52FdA$depictaiutilishared.n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
5132
5131
  }
@@ -5224,26 +5223,18 @@ function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
5224
5223
  let {
5225
5224
  content_blocks_: incoming_content_blocks,
5226
5225
  cols_at_size_: cols_at_size_,
5227
- number_of_items_shown_: number_of_items_shown_,
5228
5226
  set_top_row_shortened_by_: set_top_row_shortened_by_
5229
5227
  } = _ref;
5230
5228
  // these are by row
5231
5229
  const [content_blocks, set_content_blocks] = $52FdA$solidjsstore.createStore([]);
5232
5230
  const n_cols_currently_showing_ = $85fcdab554c24789$export$a79e666719b3647c(cols_at_size_);
5233
- const products_to_rows = products => {
5234
- const cols_currently_showing = n_cols_currently_showing_();
5235
- if (cols_currently_showing === null) return 0;
5236
- return Math.ceil(products / cols_currently_showing);
5237
- };
5238
- const showing_rows = $52FdA$solidjs.createMemo(() => products_to_rows(number_of_items_shown_()));
5239
5231
  $52FdA$solidjs.createEffect(() => {
5240
5232
  const incoming_value = incoming_content_blocks();
5241
5233
  if (!incoming_value) {
5242
5234
  set_content_blocks([]);
5243
5235
  return;
5244
5236
  }
5245
- const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
5246
- set_content_blocks($52FdA$solidjsstore.reconcile(capped_value, {
5237
+ set_content_blocks($52FdA$solidjsstore.reconcile(incoming_value, {
5247
5238
  key: "content"
5248
5239
  })); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
5249
5240
  });
@@ -5301,12 +5292,12 @@ function $f8f375d6245ffff2$var$remap_blocks_to_index(_ref2) {
5301
5292
  for (let j = 0; j < i; j++) {
5302
5293
  const row = displaced_products[j];
5303
5294
  if (row === undefined) continue; // there were no blocks in this row
5304
- let items_in_row;
5305
- if (typeof row === "number") items_in_row = row;else {
5306
- items_in_row = row.filter(item => item).length;
5307
- displaced_products[j] = items_in_row;
5295
+ let displaced_items_in_row;
5296
+ if (typeof row === "number") displaced_items_in_row = row;else {
5297
+ displaced_items_in_row = row.filter(item => item).length;
5298
+ displaced_products[j] = displaced_items_in_row;
5308
5299
  }
5309
- displacement_by_added_blocks += items_in_row;
5300
+ displacement_by_added_blocks += displaced_items_in_row;
5310
5301
  }
5311
5302
  const index_of_us_in_row = target_index - index_of_first_item_in_row;
5312
5303
  for (let j = 0; j < index_of_us_in_row; j++) {
@@ -5351,9 +5342,12 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
5351
5342
  var _max_span_columns;
5352
5343
  return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
5353
5344
  };
5354
- return $52FdA$solidjs.mergeProps(block, {
5355
- // Create content divs for the blocks with as much fine-grained diffing as possible?
5356
- content: (() => {
5345
+ const [rendering_delayed, set_rendering_delayed_] = $52FdA$solidjs.createSignal(true);
5346
+ const content = $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
5347
+ get when() {
5348
+ return !rendering_delayed();
5349
+ },
5350
+ get children() {
5357
5351
  const _el$ = $52FdA$solidjsweb.getNextElement($f8f375d6245ffff2$var$_tmpl$);
5358
5352
  $52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent($f8f375d6245ffff2$var$RenderContent, {
5359
5353
  get content() {
@@ -5376,7 +5370,16 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
5376
5370
  _v$3: undefined
5377
5371
  });
5378
5372
  return _el$;
5379
- })(),
5373
+ }
5374
+ });
5375
+ return $52FdA$solidjs.mergeProps(block, {
5376
+ // Create content divs for the blocks with as much fine-grained diffing as possible?
5377
+ content: () => {
5378
+ // 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
5379
+ // 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
5380
+ set_rendering_delayed_(false);
5381
+ return content;
5382
+ },
5380
5383
  get span_columns() {
5381
5384
  // Cap max width of block to the number of columns available, for everyone downstream
5382
5385
  return get_span_columns();
@@ -5473,8 +5476,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
5473
5476
  let fallback_is_alive = false;
5474
5477
  const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $52FdA$solidjs.createSignal(true);
5475
5478
  const [top_row_shortened_by_, set_top_row_shortened_by_] = $52FdA$solidjs.createSignal(0);
5476
- const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $52FdA$solidjs.createSignal(false);
5477
- const [number_loaded_displays, set_number_loaded_displays_] = $52FdA$solidjs.createSignal(0);
5479
+ $52FdA$solidjs.createSignal(false);
5478
5480
  const modified_cols_at_size = $c749e60bca5000cb$export$cb5808ba002cdeed({
5479
5481
  layout_options_: layout_options_,
5480
5482
  sort_or_filter_open_: sort_or_filter_open_
@@ -5489,12 +5491,10 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
5489
5491
  return for_id === id_currently_querying_for_();
5490
5492
  })) === 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_);
5491
5493
  });
5492
- const number_of_items_shown_ = $52FdA$solidjs.createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
5493
5494
  const doesnt_have_content_blocks = $52FdA$solidjs.createMemo(() => !content_blocks_by_row_());
5494
5495
  const content_blocks_ = $52FdA$solidjs.createMemo(() => doesnt_have_content_blocks() ? () => [] : $f8f375d6245ffff2$export$791ef57e62e21c3f({
5495
5496
  content_blocks_: content_blocks_by_row_,
5496
5497
  cols_at_size_: modified_cols_at_size,
5497
- number_of_items_shown_: number_of_items_shown_,
5498
5498
  set_top_row_shortened_by_: set_top_row_shortened_by_
5499
5499
  }));
5500
5500
  const rendered_placeholders = $52FdA$solidjs.createMemo(() => get_should_have_placeholders_rendered() ? $e3915574cfd3466c$export$f33414a4df0afd3f({
@@ -5534,8 +5534,6 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
5534
5534
  get fallback() {
5535
5535
  fallback_is_alive = true;
5536
5536
  $52FdA$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
5537
- set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
5538
- $52FdA$solidjs.onCleanup(() => set_product_card_suspense_is_in_fallback(false));
5539
5537
  return $52FdA$solidjs.createMemo(() => {
5540
5538
  // 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
5541
5539
  // In future we could have individual suspense's for each product card, but that's too much for now
@@ -5560,8 +5558,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
5560
5558
  query_base_: query_base_,
5561
5559
  depict_api_: depict_api_,
5562
5560
  is_loading_: is_loading_,
5563
- content_blocks_: content_blocks_,
5564
- set_number_loaded_displays_: set_number_loaded_displays_
5561
+ content_blocks_: content_blocks_
5565
5562
  });
5566
5563
  $52FdA$solidjs.onCleanup(() => suspense_contents = undefined);
5567
5564
  return suspense_contents;
package/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 { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "2.1.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: ProductListingRequest): Promise<ProductListingResponseAfterURLCreator & {
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/ES10/index.js CHANGED
@@ -9,7 +9,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$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.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_";
@@ -4903,8 +4903,7 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
4903
4903
  query_base_: query_base_,
4904
4904
  depict_api_: depict_api_,
4905
4905
  is_loading_: is_loading_,
4906
- content_blocks_: content_blocks_,
4907
- set_number_loaded_displays_: set_number_loaded_displays_
4906
+ content_blocks_: content_blocks_
4908
4907
  } = _ref;
4909
4908
  // 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
4910
4909
  const target_to_index_map = new Map();
@@ -4951,7 +4950,6 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
4951
4950
  query_base_: query_base_,
4952
4951
  depict_api_: depict_api_
4953
4952
  });
4954
- $8tj43$createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
4955
4953
  return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
4956
4954
  displays_by_key_: displays_by_key_,
4957
4955
  merchant_: merchant_,
@@ -5041,25 +5039,26 @@ function $64d94dcaa058dc7b$var$generate_media_queried_declarations(_ref) {
5041
5039
  } = _ref;
5042
5040
  return cols_at_size_.map(options => {
5043
5041
  const [n_cols, min, max, grid_spacing_for_size] = options;
5044
- const spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
5042
+ const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
5045
5043
  // See comment in else block below
5046
- 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_));
5044
+ 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);
5047
5045
  let spacing_styling;
5048
5046
  let additional_styling = ""; // outside the media query
5049
- if (can_use_gap) spacing_styling = "gap:".concat(spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
5047
+ if (can_use_gap) spacing_styling = "gap:".concat(main_spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
5050
5048
  // 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)
5051
5049
  // 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.
5052
5050
  // Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
5053
5051
  // 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.
5052
+ const vertical_spacing_to_use = override_vertical_spacing_ !== null && override_vertical_spacing_ !== void 0 ? override_vertical_spacing_ : main_spacing_to_use;
5054
5053
  const width_multiplier = "var(".concat($64d94dcaa058dc7b$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
5055
- 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
5054
+ 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
5056
5055
  // Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
5057
5056
  const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
5058
- const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($64d94dcaa058dc7b$var$strip_percent_unit(spacing_to_use), ")"); // Width of the gaps
5057
+ 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
5059
5058
  const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
5060
5059
  // 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
5061
5060
  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)
5062
- spacing_styling = "column-gap:".concat(spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
5061
+ spacing_styling = "column-gap:".concat(main_spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
5063
5062
  // Re-use old layout code to get the correct :nth-child declarations for the top margins
5064
5063
  additional_styling = $8tj43$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_);
5065
5064
  }
@@ -5157,26 +5156,18 @@ function $ff7feae4dddd6073$export$791ef57e62e21c3f(_ref) {
5157
5156
  let {
5158
5157
  content_blocks_: incoming_content_blocks,
5159
5158
  cols_at_size_: cols_at_size_,
5160
- number_of_items_shown_: number_of_items_shown_,
5161
5159
  set_top_row_shortened_by_: set_top_row_shortened_by_
5162
5160
  } = _ref;
5163
5161
  // these are by row
5164
5162
  const [content_blocks, set_content_blocks] = $8tj43$createStore([]);
5165
5163
  const n_cols_currently_showing_ = $8244fdad249f8d5f$export$a79e666719b3647c(cols_at_size_);
5166
- const products_to_rows = products => {
5167
- const cols_currently_showing = n_cols_currently_showing_();
5168
- if (cols_currently_showing === null) return 0;
5169
- return Math.ceil(products / cols_currently_showing);
5170
- };
5171
- const showing_rows = $8tj43$createMemo(() => products_to_rows(number_of_items_shown_()));
5172
5164
  $8tj43$createEffect(() => {
5173
5165
  const incoming_value = incoming_content_blocks();
5174
5166
  if (!incoming_value) {
5175
5167
  set_content_blocks([]);
5176
5168
  return;
5177
5169
  }
5178
- const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
5179
- set_content_blocks($8tj43$reconcile(capped_value, {
5170
+ set_content_blocks($8tj43$reconcile(incoming_value, {
5180
5171
  key: "content"
5181
5172
  })); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
5182
5173
  });
@@ -5234,12 +5225,12 @@ function $ff7feae4dddd6073$var$remap_blocks_to_index(_ref2) {
5234
5225
  for (let j = 0; j < i; j++) {
5235
5226
  const row = displaced_products[j];
5236
5227
  if (row === undefined) continue; // there were no blocks in this row
5237
- let items_in_row;
5238
- if (typeof row === "number") items_in_row = row;else {
5239
- items_in_row = row.filter(item => item).length;
5240
- displaced_products[j] = items_in_row;
5228
+ let displaced_items_in_row;
5229
+ if (typeof row === "number") displaced_items_in_row = row;else {
5230
+ displaced_items_in_row = row.filter(item => item).length;
5231
+ displaced_products[j] = displaced_items_in_row;
5241
5232
  }
5242
- displacement_by_added_blocks += items_in_row;
5233
+ displacement_by_added_blocks += displaced_items_in_row;
5243
5234
  }
5244
5235
  const index_of_us_in_row = target_index - index_of_first_item_in_row;
5245
5236
  for (let j = 0; j < index_of_us_in_row; j++) {
@@ -5284,9 +5275,12 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
5284
5275
  var _max_span_columns;
5285
5276
  return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
5286
5277
  };
5287
- return $8tj43$mergeProps1(block, {
5288
- // Create content divs for the blocks with as much fine-grained diffing as possible?
5289
- content: (() => {
5278
+ const [rendering_delayed, set_rendering_delayed_] = $8tj43$createSignal(true);
5279
+ const content = $8tj43$createComponent((0, $8tj43$Show), {
5280
+ get when() {
5281
+ return !rendering_delayed();
5282
+ },
5283
+ get children() {
5290
5284
  const _el$ = $8tj43$getNextElement($ff7feae4dddd6073$var$_tmpl$);
5291
5285
  $8tj43$insert(_el$, $8tj43$createComponent($ff7feae4dddd6073$var$RenderContent, {
5292
5286
  get content() {
@@ -5309,7 +5303,16 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
5309
5303
  _v$3: undefined
5310
5304
  });
5311
5305
  return _el$;
5312
- })(),
5306
+ }
5307
+ });
5308
+ return $8tj43$mergeProps1(block, {
5309
+ // Create content divs for the blocks with as much fine-grained diffing as possible?
5310
+ content: () => {
5311
+ // 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
5312
+ // 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
5313
+ set_rendering_delayed_(false);
5314
+ return content;
5315
+ },
5313
5316
  get span_columns() {
5314
5317
  // Cap max width of block to the number of columns available, for everyone downstream
5315
5318
  return get_span_columns();
@@ -5406,8 +5409,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
5406
5409
  let fallback_is_alive = false;
5407
5410
  const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $8tj43$createSignal(true);
5408
5411
  const [top_row_shortened_by_, set_top_row_shortened_by_] = $8tj43$createSignal(0);
5409
- const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $8tj43$createSignal(false);
5410
- const [number_loaded_displays, set_number_loaded_displays_] = $8tj43$createSignal(0);
5412
+ $8tj43$createSignal(false);
5411
5413
  const modified_cols_at_size = $b2dbaafb23d00c7f$export$cb5808ba002cdeed({
5412
5414
  layout_options_: layout_options_,
5413
5415
  sort_or_filter_open_: sort_or_filter_open_
@@ -5422,12 +5424,10 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
5422
5424
  return for_id === id_currently_querying_for_();
5423
5425
  })) === 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_);
5424
5426
  });
5425
- const number_of_items_shown_ = $8tj43$createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
5426
5427
  const doesnt_have_content_blocks = $8tj43$createMemo(() => !content_blocks_by_row_());
5427
5428
  const content_blocks_ = $8tj43$createMemo(() => doesnt_have_content_blocks() ? () => [] : $ff7feae4dddd6073$export$791ef57e62e21c3f({
5428
5429
  content_blocks_: content_blocks_by_row_,
5429
5430
  cols_at_size_: modified_cols_at_size,
5430
- number_of_items_shown_: number_of_items_shown_,
5431
5431
  set_top_row_shortened_by_: set_top_row_shortened_by_
5432
5432
  }));
5433
5433
  const rendered_placeholders = $8tj43$createMemo(() => get_should_have_placeholders_rendered() ? $bdd80c7862246dc2$export$f33414a4df0afd3f({
@@ -5467,8 +5467,6 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
5467
5467
  get fallback() {
5468
5468
  fallback_is_alive = true;
5469
5469
  $8tj43$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
5470
- set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
5471
- $8tj43$onCleanup(() => set_product_card_suspense_is_in_fallback(false));
5472
5470
  return $8tj43$createMemo(() => {
5473
5471
  // 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
5474
5472
  // In future we could have individual suspense's for each product card, but that's too much for now
@@ -5493,8 +5491,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
5493
5491
  query_base_: query_base_,
5494
5492
  depict_api_: depict_api_,
5495
5493
  is_loading_: is_loading_,
5496
- content_blocks_: content_blocks_,
5497
- set_number_loaded_displays_: set_number_loaded_displays_
5494
+ content_blocks_: content_blocks_
5498
5495
  });
5499
5496
  $8tj43$onCleanup(() => suspense_contents = undefined);
5500
5497
  return suspense_contents;
package/latest/index.cjs CHANGED
@@ -70,7 +70,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
70
70
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
71
71
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
72
72
  /*! Depict.ai search and product listing SDK */
73
- const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.1";
73
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.3";
74
74
  const $1ab22f2cd39b3061$var$fallback_operator = "in";
75
75
  const $1ab22f2cd39b3061$var$fallback_token = "";
76
76
  const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
@@ -4632,8 +4632,7 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
4632
4632
  query_base_: query_base_,
4633
4633
  depict_api_: depict_api_,
4634
4634
  is_loading_: is_loading_,
4635
- content_blocks_: content_blocks_,
4636
- set_number_loaded_displays_: set_number_loaded_displays_
4635
+ content_blocks_: content_blocks_
4637
4636
  }) {
4638
4637
  // 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
4639
4638
  const target_to_index_map = new Map();
@@ -4677,7 +4676,6 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
4677
4676
  query_base_: query_base_,
4678
4677
  depict_api_: depict_api_
4679
4678
  });
4680
- $gVhhF$solidjs.createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
4681
4679
  return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
4682
4680
  displays_by_key_: displays_by_key_,
4683
4681
  merchant_: merchant_,
@@ -4764,25 +4762,26 @@ function $75777da1687ba3f6$var$generate_media_queried_declarations({
4764
4762
  }) {
4765
4763
  return cols_at_size_.map(options => {
4766
4764
  const [n_cols, min, max, grid_spacing_for_size] = options;
4767
- const spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
4765
+ const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
4768
4766
  // See comment in else block below
4769
- const can_use_gap = $75777da1687ba3f6$var$can_use_gap_for_unit(spacing_to_use) && (!override_vertical_spacing_ || $75777da1687ba3f6$var$can_use_gap_for_unit(override_vertical_spacing_));
4767
+ const can_use_gap = override_vertical_spacing_ ? $75777da1687ba3f6$var$can_use_gap_for_unit(override_vertical_spacing_) : $75777da1687ba3f6$var$can_use_gap_for_unit(main_spacing_to_use);
4770
4768
  let spacing_styling;
4771
4769
  let additional_styling = ""; // outside the media query
4772
- if (can_use_gap) spacing_styling = `gap:${spacing_to_use};${override_vertical_spacing_ ? `row-gap:${override_vertical_spacing_};` : ``}`;else {
4770
+ if (can_use_gap) spacing_styling = `gap:${main_spacing_to_use};${override_vertical_spacing_ ? `row-gap:${override_vertical_spacing_};` : ``}`;else {
4773
4771
  // 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)
4774
4772
  // 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.
4775
4773
  // Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
4776
4774
  // 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.
4775
+ const vertical_spacing_to_use = override_vertical_spacing_ ?? main_spacing_to_use;
4777
4776
  const width_multiplier = `var(${$75777da1687ba3f6$export$c500183c31c2b22e}, 1)`; // How many cards wide the current item is (needed because content blocks)
4778
- const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$75777da1687ba3f6$var$strip_percent_unit(spacing_to_use)} / 2)) / ${n_cols}))`; // Width of one item in percent of the whole
4777
+ const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$75777da1687ba3f6$var$strip_percent_unit(vertical_spacing_to_use)} / 2)) / ${n_cols}))`; // Width of one item in percent of the whole
4779
4778
  // Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
4780
4779
  const this_item_width_meat = `calc(${one_item_width_exclusing_gaps} * ${width_multiplier})`; // Width of just the card
4781
- const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$75777da1687ba3f6$var$strip_percent_unit(spacing_to_use)})`; // Width of the gaps
4780
+ const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$75777da1687ba3f6$var$strip_percent_unit(vertical_spacing_to_use)})`; // Width of the gaps
4782
4781
  const this_item_width = `calc(${this_item_width_meat} + ${this_item_width_gaps})`; // Width of this item including gaps
4783
4782
  // 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
4784
4783
  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)
4785
- spacing_styling = `column-gap:${spacing_to_use};`; // Still use gaps in the horizontal direction because that works flawlessly
4784
+ spacing_styling = `column-gap:${main_spacing_to_use};`; // Still use gaps in the horizontal direction because that works flawlessly
4786
4785
  // Re-use old layout code to get the correct :nth-child declarations for the top margins
4787
4786
  additional_styling = $gVhhF$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_);
4788
4787
  }
@@ -4871,26 +4870,18 @@ const $d92f338ba8f9da9b$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<d
4871
4870
  function $d92f338ba8f9da9b$export$791ef57e62e21c3f({
4872
4871
  content_blocks_: incoming_content_blocks,
4873
4872
  cols_at_size_: cols_at_size_,
4874
- number_of_items_shown_: number_of_items_shown_,
4875
4873
  set_top_row_shortened_by_: set_top_row_shortened_by_
4876
4874
  }) {
4877
4875
  // these are by row
4878
4876
  const [content_blocks, set_content_blocks] = $gVhhF$solidjsstore.createStore([]);
4879
4877
  const n_cols_currently_showing_ = $055384b985678603$export$a79e666719b3647c(cols_at_size_);
4880
- const products_to_rows = products => {
4881
- const cols_currently_showing = n_cols_currently_showing_();
4882
- if (cols_currently_showing === null) return 0;
4883
- return Math.ceil(products / cols_currently_showing);
4884
- };
4885
- const showing_rows = $gVhhF$solidjs.createMemo(() => products_to_rows(number_of_items_shown_()));
4886
4878
  $gVhhF$solidjs.createEffect(() => {
4887
4879
  const incoming_value = incoming_content_blocks();
4888
4880
  if (!incoming_value) {
4889
4881
  set_content_blocks([]);
4890
4882
  return;
4891
4883
  }
4892
- const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
4893
- set_content_blocks($gVhhF$solidjsstore.reconcile(capped_value, {
4884
+ set_content_blocks($gVhhF$solidjsstore.reconcile(incoming_value, {
4894
4885
  key: "content"
4895
4886
  })); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
4896
4887
  });
@@ -4947,12 +4938,12 @@ function $d92f338ba8f9da9b$var$remap_blocks_to_index({
4947
4938
  for (let j = 0; j < i; j++) {
4948
4939
  const row = displaced_products[j];
4949
4940
  if (row === undefined) continue; // there were no blocks in this row
4950
- let items_in_row;
4951
- if (typeof row === "number") items_in_row = row;else {
4952
- items_in_row = row.filter(item => item).length;
4953
- displaced_products[j] = items_in_row;
4941
+ let displaced_items_in_row;
4942
+ if (typeof row === "number") displaced_items_in_row = row;else {
4943
+ displaced_items_in_row = row.filter(item => item).length;
4944
+ displaced_products[j] = displaced_items_in_row;
4954
4945
  }
4955
- displacement_by_added_blocks += items_in_row;
4946
+ displacement_by_added_blocks += displaced_items_in_row;
4956
4947
  }
4957
4948
  const index_of_us_in_row = target_index - index_of_first_item_in_row;
4958
4949
  for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products[i]?.[j])
@@ -4990,9 +4981,12 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
4990
4981
  const get_wrapped_blocks = $gVhhF$solidjs.mapArray(() => rendered_content_blocks, block => {
4991
4982
  if (!block) return;
4992
4983
  const get_span_columns = () => Math.min(block.span_columns, max_span_columns() ?? Infinity);
4993
- return $gVhhF$solidjs.mergeProps(block, {
4994
- // Create content divs for the blocks with as much fine-grained diffing as possible?
4995
- content: (() => {
4984
+ const [rendering_delayed, set_rendering_delayed_] = $gVhhF$solidjs.createSignal(true);
4985
+ const content = $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
4986
+ get when() {
4987
+ return !rendering_delayed();
4988
+ },
4989
+ get children() {
4996
4990
  const _el$ = $gVhhF$solidjsweb.getNextElement($d92f338ba8f9da9b$var$_tmpl$);
4997
4991
  $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent($d92f338ba8f9da9b$var$RenderContent, {
4998
4992
  get content() {
@@ -5015,7 +5009,16 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
5015
5009
  _v$3: undefined
5016
5010
  });
5017
5011
  return _el$;
5018
- })(),
5012
+ }
5013
+ });
5014
+ return $gVhhF$solidjs.mergeProps(block, {
5015
+ // Create content divs for the blocks with as much fine-grained diffing as possible?
5016
+ content: () => {
5017
+ // 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
5018
+ // 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
5019
+ set_rendering_delayed_(false);
5020
+ return content;
5021
+ },
5019
5022
  get span_columns() {
5020
5023
  // Cap max width of block to the number of columns available, for everyone downstream
5021
5024
  return get_span_columns();
@@ -5109,8 +5112,7 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
5109
5112
  let fallback_is_alive = false;
5110
5113
  const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $gVhhF$solidjs.createSignal(true);
5111
5114
  const [top_row_shortened_by_, set_top_row_shortened_by_] = $gVhhF$solidjs.createSignal(0);
5112
- const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $gVhhF$solidjs.createSignal(false);
5113
- const [number_loaded_displays, set_number_loaded_displays_] = $gVhhF$solidjs.createSignal(0);
5115
+ $gVhhF$solidjs.createSignal(false);
5114
5116
  const modified_cols_at_size = $738c3a81fc46a340$export$cb5808ba002cdeed({
5115
5117
  layout_options_: layout_options_,
5116
5118
  sort_or_filter_open_: sort_or_filter_open_
@@ -5121,12 +5123,10 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
5121
5123
  for_id: for_id
5122
5124
  }) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
5123
5125
  });
5124
- const number_of_items_shown_ = $gVhhF$solidjs.createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
5125
5126
  const doesnt_have_content_blocks = $gVhhF$solidjs.createMemo(() => !content_blocks_by_row_());
5126
5127
  const content_blocks_ = $gVhhF$solidjs.createMemo(() => doesnt_have_content_blocks() ? () => [] : $d92f338ba8f9da9b$export$791ef57e62e21c3f({
5127
5128
  content_blocks_: content_blocks_by_row_,
5128
5129
  cols_at_size_: modified_cols_at_size,
5129
- number_of_items_shown_: number_of_items_shown_,
5130
5130
  set_top_row_shortened_by_: set_top_row_shortened_by_
5131
5131
  }));
5132
5132
  const rendered_placeholders = $gVhhF$solidjs.createMemo(() => get_should_have_placeholders_rendered() ? $0caf87eaa19079da$export$f33414a4df0afd3f({
@@ -5166,8 +5166,6 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
5166
5166
  get fallback() {
5167
5167
  fallback_is_alive = true;
5168
5168
  $gVhhF$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
5169
- set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
5170
- $gVhhF$solidjs.onCleanup(() => set_product_card_suspense_is_in_fallback(false));
5171
5169
  return $gVhhF$solidjs.createMemo(() => {
5172
5170
  // 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
5173
5171
  // In future we could have individual suspense's for each product card, but that's too much for now
@@ -5192,8 +5190,7 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
5192
5190
  query_base_: query_base_,
5193
5191
  depict_api_: depict_api_,
5194
5192
  is_loading_: is_loading_,
5195
- content_blocks_: content_blocks_,
5196
- set_number_loaded_displays_: set_number_loaded_displays_
5193
+ content_blocks_: content_blocks_
5197
5194
  });
5198
5195
  $gVhhF$solidjs.onCleanup(() => suspense_contents = undefined);
5199
5196
  return suspense_contents;
package/latest/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 { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "2.1.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: ProductListingRequest): Promise<ProductListingResponseAfterURLCreator & {
673
+ list(input_req: ProductListingRequestV2): Promise<ProductListingResponseAfterURLCreator & {
674
674
  failed?: true;
675
675
  }>;
676
676
  get_recommended<T extends Display>(input_req: BaseSearchRequest): Promise<{