@depict-ai/ui 4.10.21 → 4.10.24

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/latest/index.js CHANGED
@@ -7,7 +7,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "4.10.21";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.10.24";
11
11
  function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
12
12
  const signal = $9HbP8$createSignal(false);
13
13
  $9HbP8$onCleanup($9HbP8$javascript_media_query(media_query, ({
@@ -1130,8 +1130,14 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
1130
1130
  setFirstResultInViewport(Math.min(...intersecting) + 1); // +1 because we want to start counting at 1
1131
1131
  setLastResultsInViewport(Math.max(...intersecting) + 1);
1132
1132
  });
1133
- return renderedDisplays_;
1133
+ // Content blocks placed after the last product (but still in its row) have no product card to render in front of, so render them after the cards once there are no more products to load
1134
+ const trailingContentBlocks_ = $9HbP8$createMemo(() => {
1135
+ if (!all_products_loaded_[0]()) return [];
1136
+ return content_blocks_?.()?.trailing_?.(displays_by_key_().size) || [];
1137
+ });
1138
+ return [renderedDisplays_, trailingContentBlocks_]; // Regarding the as unknown: https://github.com/solidjs/solid/releases/tag/v1.7.0
1134
1139
  }
1140
+
1135
1141
  var $c8d5ff4524619fcd$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div>`),
1136
1142
  $c8d5ff4524619fcd$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<style type=text/css>`);
1137
1143
  function $c8d5ff4524619fcd$export$d21e32dfedac04be(props) {
@@ -1481,10 +1487,18 @@ function $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
1481
1487
  set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
1482
1488
  });
1483
1489
 
1484
- return $9HbP8$createMemo(() => $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
1490
+ const remapped_ = $9HbP8$createMemo(() => $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
1485
1491
  wrapped_blocks_: get_wrapped_blocks_(),
1486
1492
  n_cols_currently_showing_: n_cols_currently_showing_()
1487
- }).content_blocks_by_index_);
1493
+ }));
1494
+ const content_blocks_by_index_ = $9HbP8$createMemo(() => remapped_().content_blocks_by_index_);
1495
+ return Object.assign(content_blocks_by_index_, {
1496
+ trailing_: product_count => $e7a7eb102ddc0c79$export$b94605e5b3ce01c({
1497
+ ...remapped_(),
1498
+ n_cols_currently_showing_: n_cols_currently_showing_(),
1499
+ product_count: product_count
1500
+ })
1501
+ });
1488
1502
  }
1489
1503
  function $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
1490
1504
  wrapped_blocks_: wrapped_blocks_,
@@ -1492,13 +1506,16 @@ function $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
1492
1506
  }) {
1493
1507
  // This computation should be quite cheap since it just moves around things into an array
1494
1508
  const content_blocks_by_index_ = [];
1509
+ const rows_by_index_ = []; // the row of each block at each index of content_blocks_by_index_, in the same order
1495
1510
  const constructed_block_arrays = new WeakSet();
1496
1511
  // Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
1497
1512
  const displaced_products_ = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
1498
1513
  if (!n_cols_currently_showing_)
1499
1514
  // Nope out of here if we don't know how many columns are showing
1500
1515
  return {
1501
- content_blocks_by_index_: content_blocks_by_index_
1516
+ content_blocks_by_index_: content_blocks_by_index_,
1517
+ rows_by_index_: rows_by_index_,
1518
+ displaced_products_: displaced_products_
1502
1519
  };
1503
1520
  for (let i = 0; i < wrapped_blocks_.length; i++) {
1504
1521
  // i = row to show at
@@ -1543,6 +1560,7 @@ function $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
1543
1560
  content_blocks_by_index_[final_target_index] = array;
1544
1561
  }
1545
1562
  } else content_blocks_by_index_[final_target_index] = block_content;
1563
+ (rows_by_index_[final_target_index] ||= []).push(i);
1546
1564
  // Update displacement
1547
1565
  for (let j = 0; j < span_rows; j++) {
1548
1566
  const row = displaced_products_[i + j] ||= [];
@@ -1551,20 +1569,65 @@ function $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
1551
1569
  }
1552
1570
  return {
1553
1571
  content_blocks_by_index_: content_blocks_by_index_,
1572
+ rows_by_index_: rows_by_index_,
1554
1573
  displaced_products_: displaced_products_
1555
1574
  };
1556
1575
  }
1557
- /**
1558
- * Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
1559
- * Then renders the content and wraps it into a div with the correct styling.
1560
- * Also caps span_columns to max available columns
1561
- */
1576
+ function $e7a7eb102ddc0c79$export$b94605e5b3ce01c({
1577
+ content_blocks_by_index_: content_blocks_by_index_,
1578
+ rows_by_index_: rows_by_index_,
1579
+ displaced_products_: displaced_products_,
1580
+ n_cols_currently_showing_: n_cols_currently_showing_,
1581
+ product_count: product_count
1582
+ }) {
1583
+ const trailing = [];
1584
+ if (!n_cols_currently_showing_ || product_count <= 0) return trailing;
1585
+ // Find the row the last product lands in: each row has room for the columns that blocks don't take up
1586
+ let last_product_row = 0;
1587
+ let last_product_row_is_full = false;
1588
+ for (let seen_products = 0;; last_product_row++) {
1589
+ const row = displaced_products_[last_product_row];
1590
+ const taken_by_blocks = typeof row === "number" ? row : row ? row.filter(item => item).length : 0;
1591
+ const product_slots_in_row = Math.max(0, n_cols_currently_showing_ - taken_by_blocks);
1592
+ if (seen_products + product_slots_in_row >= product_count) {
1593
+ last_product_row_is_full = seen_products + product_slots_in_row === product_count;
1594
+ break;
1595
+ }
1596
+ seen_products += product_slots_in_row;
1597
+ // Rows past the ones blocks take up all have room for products, so we're done by then at the latest
1598
+ if (last_product_row >= displaced_products_.length + product_count) break;
1599
+ }
1600
+ for (let i = product_count; i < content_blocks_by_index_.length; i++) {
1601
+ const block = content_blocks_by_index_[i];
1602
+ if (block === undefined) continue;
1603
+ const rows = rows_by_index_[i] || [];
1604
+ const last_allowed_row = last_product_row + (last_product_row_is_full ? 1 : 0);
1605
+ if (Array.isArray(block) && rows.length > 1) {
1606
+ // Several blocks can share this index. Keep only blocks in allowed trailing rows.
1607
+ const in_trailing_rows = block.filter((_, j) => rows[j] <= last_allowed_row);
1608
+ if (in_trailing_rows.length) trailing.push(in_trailing_rows);
1609
+ continue;
1610
+ }
1611
+ if ((rows[0] ?? Infinity) > last_allowed_row) continue; // Keep cards meant for later rows hidden after filtering.
1612
+ trailing.push(block);
1613
+ }
1614
+ return trailing;
1615
+ }
1616
+ function $e7a7eb102ddc0c79$export$911278b0390ae36e(block, max_span_columns) {
1617
+ const span_columns = Math.min(block.span_columns, max_span_columns ?? Infinity);
1618
+ const spans_whole_row = span_columns === max_span_columns;
1619
+ return {
1620
+ span_columns: span_columns,
1621
+ span_rows: spans_whole_row ? 1 : block.span_rows,
1622
+ spans_whole_row: spans_whole_row
1623
+ };
1624
+ }
1562
1625
  function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
1563
1626
  const get_wrapped_blocks = $9HbP8$mapArray(() => rendered_content_blocks, block => {
1564
1627
  if (!block) return;
1565
- const final_span_columns = $9HbP8$createMemo(() => Math.min(block.span_columns, max_span_columns() ?? Infinity));
1566
- // If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
1567
- const final_span_rows = $9HbP8$createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
1628
+ const final_spans = $9HbP8$createMemo(() => $e7a7eb102ddc0c79$export$911278b0390ae36e(block, max_span_columns()));
1629
+ const final_span_columns = $9HbP8$createMemo(() => final_spans().span_columns);
1630
+ const final_span_rows = $9HbP8$createMemo(() => final_spans().span_rows);
1568
1631
  const [rendering_delayed, set_rendering_delayed_] = $9HbP8$createSignal(true);
1569
1632
  const content = $9HbP8$createComponent((0, $9HbP8$Show), {
1570
1633
  get when() {
@@ -1578,7 +1641,7 @@ function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_s
1578
1641
  }
1579
1642
  }));
1580
1643
  $9HbP8$effect(_p$ => {
1581
- var _v$ = !!(final_span_columns() === max_span_columns()),
1644
+ var _v$ = !!final_spans().spans_whole_row,
1582
1645
  _v$2 = {
1583
1646
  [(0, $6dee9211e57ac31a$export$c500183c31c2b22e)]: final_span_columns()
1584
1647
  },
@@ -1603,6 +1666,7 @@ function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_s
1603
1666
  content: () => {
1604
1667
  // 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
1605
1668
  // 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
1669
+ // (or, once all products have loaded, ResultsProductCards renders the blocks placed after the last product)
1606
1670
  set_rendering_delayed_(false);
1607
1671
  return content;
1608
1672
  },
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "4.10.21",
3
+ "repository": {
4
+ "type": "git",
5
+ "url": "git+https://github.com/depict-org/depict-ui.git",
6
+ "directory": "browser-tags-v2/packages/ui"
7
+ },
8
+ "version": "4.10.24",
4
9
  "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
10
  "packageManager": "yarn@3.2.2",
6
11
  "sass": "styles.scss",
@@ -236,9 +241,9 @@
236
241
  "@babel/plugin-transform-typescript": "^7.22.9",
237
242
  "@babel/runtime": "^7.22.6",
238
243
  "@babel/runtime-corejs3": "^7.22.6",
239
- "@depict-ai/plp-styling": "^4.6.13",
240
- "@depict-ai/types": "^5.6.11",
241
- "@depict-ai/utilishared": "^2.6.11",
244
+ "@depict-ai/plp-styling": "^4.6.15",
245
+ "@depict-ai/types": "^5.6.13",
246
+ "@depict-ai/utilishared": "^2.6.13",
242
247
  "solid-js": "^1.9.10"
243
248
  },
244
249
  "type": "module",
@@ -115,7 +115,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7
115
115
  $parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
116
116
  $parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
117
117
  /*! Depict.ai search and product listing SDK */
118
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.10.21";
118
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.10.24";
119
119
  function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
120
120
  const signal = $3hooq$solidjs.createSignal(false);
121
121
  $3hooq$solidjs.onCleanup($3hooq$depictaiutilishared.javascript_media_query(media_query, _ref => {
@@ -1046,8 +1046,15 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
1046
1046
  setFirstResultInViewport(Math.min(...intersecting) + 1); // +1 because we want to start counting at 1
1047
1047
  setLastResultsInViewport(Math.max(...intersecting) + 1);
1048
1048
  });
1049
- return renderedDisplays_;
1049
+ // Content blocks placed after the last product (but still in its row) have no product card to render in front of, so render them after the cards once there are no more products to load
1050
+ const trailingContentBlocks_ = $3hooq$solidjs.createMemo(() => {
1051
+ var _content_blocks_, _content_blocks_$trai;
1052
+ if (!all_products_loaded_[0]()) return [];
1053
+ return (content_blocks_ === null || content_blocks_ === void 0 ? void 0 : (_content_blocks_ = content_blocks_()) === null || _content_blocks_ === void 0 ? void 0 : (_content_blocks_$trai = _content_blocks_.trailing_) === null || _content_blocks_$trai === void 0 ? void 0 : _content_blocks_$trai.call(_content_blocks_, displays_by_key_().size)) || [];
1054
+ });
1055
+ return [renderedDisplays_, trailingContentBlocks_]; // Regarding the as unknown: https://github.com/solidjs/solid/releases/tag/v1.7.0
1050
1056
  }
1057
+
1051
1058
  var $6c2c739b113a8ddf$var$_tmpl$ = ["<div", ' class="', '">', "</div>"],
1052
1059
  $6c2c739b113a8ddf$var$_tmpl$2 = ["<style", ' type="text/css">', "</style>"];
1053
1060
  function $6c2c739b113a8ddf$export$d21e32dfedac04be(props) {
@@ -1365,10 +1372,18 @@ function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
1365
1372
  set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
1366
1373
  });
1367
1374
 
1368
- return $3hooq$solidjs.createMemo(() => $f8f375d6245ffff2$export$92aa5d691d588f3f({
1375
+ const remapped_ = $3hooq$solidjs.createMemo(() => $f8f375d6245ffff2$export$92aa5d691d588f3f({
1369
1376
  wrapped_blocks_: get_wrapped_blocks_(),
1370
1377
  n_cols_currently_showing_: n_cols_currently_showing_()
1371
- }).content_blocks_by_index_);
1378
+ }));
1379
+ const content_blocks_by_index_ = $3hooq$solidjs.createMemo(() => remapped_().content_blocks_by_index_);
1380
+ return Object.assign(content_blocks_by_index_, {
1381
+ trailing_: product_count => $f8f375d6245ffff2$export$b94605e5b3ce01c({
1382
+ ...remapped_(),
1383
+ n_cols_currently_showing_: n_cols_currently_showing_(),
1384
+ product_count: product_count
1385
+ })
1386
+ });
1372
1387
  }
1373
1388
  function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
1374
1389
  let {
@@ -1377,13 +1392,16 @@ function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
1377
1392
  } = _ref2;
1378
1393
  // This computation should be quite cheap since it just moves around things into an array
1379
1394
  const content_blocks_by_index_ = [];
1395
+ const rows_by_index_ = []; // the row of each block at each index of content_blocks_by_index_, in the same order
1380
1396
  const constructed_block_arrays = new WeakSet();
1381
1397
  // Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
1382
1398
  const displaced_products_ = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
1383
1399
  if (!n_cols_currently_showing_)
1384
1400
  // Nope out of here if we don't know how many columns are showing
1385
1401
  return {
1386
- content_blocks_by_index_: content_blocks_by_index_
1402
+ content_blocks_by_index_: content_blocks_by_index_,
1403
+ rows_by_index_: rows_by_index_,
1404
+ displaced_products_: displaced_products_
1387
1405
  };
1388
1406
  for (let i = 0; i < wrapped_blocks_.length; i++) {
1389
1407
  // i = row to show at
@@ -1431,6 +1449,7 @@ function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
1431
1449
  content_blocks_by_index_[final_target_index] = array;
1432
1450
  }
1433
1451
  } else content_blocks_by_index_[final_target_index] = block_content;
1452
+ (rows_by_index_[final_target_index] || (rows_by_index_[final_target_index] = [])).push(i);
1434
1453
  // Update displacement
1435
1454
  for (let j = 0; j < span_rows; j++) {
1436
1455
  var _ref3;
@@ -1440,30 +1459,74 @@ function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
1440
1459
  }
1441
1460
  return {
1442
1461
  content_blocks_by_index_: content_blocks_by_index_,
1462
+ rows_by_index_: rows_by_index_,
1443
1463
  displaced_products_: displaced_products_
1444
1464
  };
1445
1465
  }
1446
- /**
1447
- * Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
1448
- * Then renders the content and wraps it into a div with the correct styling.
1449
- * Also caps span_columns to max available columns
1450
- */
1466
+ function $f8f375d6245ffff2$export$b94605e5b3ce01c(_ref4) {
1467
+ let {
1468
+ content_blocks_by_index_: content_blocks_by_index_,
1469
+ rows_by_index_: rows_by_index_,
1470
+ displaced_products_: displaced_products_,
1471
+ n_cols_currently_showing_: n_cols_currently_showing_,
1472
+ product_count: product_count
1473
+ } = _ref4;
1474
+ const trailing = [];
1475
+ if (!n_cols_currently_showing_ || product_count <= 0) return trailing;
1476
+ // Find the row the last product lands in: each row has room for the columns that blocks don't take up
1477
+ let last_product_row = 0;
1478
+ let last_product_row_is_full = false;
1479
+ for (let seen_products = 0;; last_product_row++) {
1480
+ const row = displaced_products_[last_product_row];
1481
+ const taken_by_blocks = typeof row === "number" ? row : row ? row.filter(item => item).length : 0;
1482
+ const product_slots_in_row = Math.max(0, n_cols_currently_showing_ - taken_by_blocks);
1483
+ if (seen_products + product_slots_in_row >= product_count) {
1484
+ last_product_row_is_full = seen_products + product_slots_in_row === product_count;
1485
+ break;
1486
+ }
1487
+ seen_products += product_slots_in_row;
1488
+ // Rows past the ones blocks take up all have room for products, so we're done by then at the latest
1489
+ if (last_product_row >= displaced_products_.length + product_count) break;
1490
+ }
1491
+ for (let i = product_count; i < content_blocks_by_index_.length; i++) {
1492
+ var _rows$;
1493
+ const block = content_blocks_by_index_[i];
1494
+ if (block === undefined) continue;
1495
+ const rows = rows_by_index_[i] || [];
1496
+ const last_allowed_row = last_product_row + (last_product_row_is_full ? 1 : 0);
1497
+ if (Array.isArray(block) && rows.length > 1) {
1498
+ // Several blocks can share this index. Keep only blocks in allowed trailing rows.
1499
+ const in_trailing_rows = block.filter((_, j) => rows[j] <= last_allowed_row);
1500
+ if (in_trailing_rows.length) trailing.push(in_trailing_rows);
1501
+ continue;
1502
+ }
1503
+ if (((_rows$ = rows[0]) !== null && _rows$ !== void 0 ? _rows$ : Infinity) > last_allowed_row) continue; // Keep cards meant for later rows hidden after filtering.
1504
+ trailing.push(block);
1505
+ }
1506
+ return trailing;
1507
+ }
1508
+ function $f8f375d6245ffff2$export$911278b0390ae36e(block, max_span_columns) {
1509
+ const span_columns = Math.min(block.span_columns, max_span_columns !== null && max_span_columns !== void 0 ? max_span_columns : Infinity);
1510
+ const spans_whole_row = span_columns === max_span_columns;
1511
+ return {
1512
+ span_columns: span_columns,
1513
+ span_rows: spans_whole_row ? 1 : block.span_rows,
1514
+ spans_whole_row: spans_whole_row
1515
+ };
1516
+ }
1451
1517
  function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
1452
1518
  const get_wrapped_blocks = $3hooq$solidjs.mapArray(() => rendered_content_blocks, block => {
1453
1519
  if (!block) return;
1454
- const final_span_columns = $3hooq$solidjs.createMemo(() => {
1455
- var _max_span_columns;
1456
- return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
1457
- });
1458
- // If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
1459
- const final_span_rows = $3hooq$solidjs.createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
1520
+ const final_spans = $3hooq$solidjs.createMemo(() => $f8f375d6245ffff2$export$911278b0390ae36e(block, max_span_columns()));
1521
+ const final_span_columns = $3hooq$solidjs.createMemo(() => final_spans().span_columns);
1522
+ const final_span_rows = $3hooq$solidjs.createMemo(() => final_spans().span_rows);
1460
1523
  const [rendering_delayed, set_rendering_delayed_] = $3hooq$solidjs.createSignal(true);
1461
1524
  const content = $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1462
1525
  get when() {
1463
1526
  return !rendering_delayed();
1464
1527
  },
1465
1528
  get children() {
1466
- return $3hooq$solidjsweb.ssr($f8f375d6245ffff2$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "content-block-wrapper ".concat(final_span_columns() === max_span_columns() ? "spans-whole-row" : ""), "grid-column:" + "span ".concat($3hooq$solidjsweb.escape(final_span_columns(), true)) + (";grid-row:" + "span ".concat($3hooq$solidjsweb.escape(final_span_rows(), true))) + (";spans_columns_variable_name:" + $3hooq$solidjsweb.escape(final_span_columns(), true)), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent($f8f375d6245ffff2$var$RenderContent, {
1529
+ return $3hooq$solidjsweb.ssr($f8f375d6245ffff2$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "content-block-wrapper ".concat(final_spans().spans_whole_row ? "spans-whole-row" : ""), "grid-column:" + "span ".concat($3hooq$solidjsweb.escape(final_span_columns(), true)) + (";grid-row:" + "span ".concat($3hooq$solidjsweb.escape(final_span_rows(), true))) + (";spans_columns_variable_name:" + $3hooq$solidjsweb.escape(final_span_columns(), true)), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent($f8f375d6245ffff2$var$RenderContent, {
1467
1530
  get content() {
1468
1531
  return block.content;
1469
1532
  }
@@ -1475,6 +1538,7 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
1475
1538
  content: () => {
1476
1539
  // 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
1477
1540
  // 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
1541
+ // (or, once all products have loaded, ResultsProductCards renders the blocks placed after the last product)
1478
1542
  set_rendering_delayed_(false);
1479
1543
  return content;
1480
1544
  },
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
13
13
  import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
14
- export const version = "4.10.21";
14
+ export const version = "4.10.24";
15
15
  /**
16
16
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
17
17
  */
@@ -425,10 +425,8 @@ export function remap_blocks_to_index<T = () => JSX.Element | Promise<JSX.Elemen
425
425
  })[];
426
426
  n_cols_currently_showing_: number | null;
427
427
  }): {
428
- content_blocks_by_index_: (Awaited<T> | T[])[];
429
- readonly displaced_products_?: undefined;
430
- } | {
431
428
  readonly content_blocks_by_index_: (Awaited<T> | T[])[];
429
+ readonly rows_by_index_: number[][];
432
430
  readonly displaced_products_: (number | (true | undefined)[])[];
433
431
  };
434
432
  /** @jsxImportSource solid-js */
@@ -10,7 +10,7 @@ import $b8hua$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpe
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "4.10.21";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.10.24";
14
14
  function $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query) {
15
15
  const signal = $b8hua$createSignal(false);
16
16
  $b8hua$onCleanup($b8hua$javascript_media_query(media_query, _ref => {
@@ -941,8 +941,15 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
941
941
  setFirstResultInViewport(Math.min(...intersecting) + 1); // +1 because we want to start counting at 1
942
942
  setLastResultsInViewport(Math.max(...intersecting) + 1);
943
943
  });
944
- return renderedDisplays_;
944
+ // Content blocks placed after the last product (but still in its row) have no product card to render in front of, so render them after the cards once there are no more products to load
945
+ const trailingContentBlocks_ = $b8hua$createMemo(() => {
946
+ var _content_blocks_, _content_blocks_$trai;
947
+ if (!all_products_loaded_[0]()) return [];
948
+ return (content_blocks_ === null || content_blocks_ === void 0 ? void 0 : (_content_blocks_ = content_blocks_()) === null || _content_blocks_ === void 0 ? void 0 : (_content_blocks_$trai = _content_blocks_.trailing_) === null || _content_blocks_$trai === void 0 ? void 0 : _content_blocks_$trai.call(_content_blocks_, displays_by_key_().size)) || [];
949
+ });
950
+ return [renderedDisplays_, trailingContentBlocks_]; // Regarding the as unknown: https://github.com/solidjs/solid/releases/tag/v1.7.0
945
951
  }
952
+
946
953
  var $63f1f8dbcd07d3b0$var$_tmpl$ = ["<div", ' class="', '">', "</div>"],
947
954
  $63f1f8dbcd07d3b0$var$_tmpl$2 = ["<style", ' type="text/css">', "</style>"];
948
955
  function $63f1f8dbcd07d3b0$export$d21e32dfedac04be(props) {
@@ -1260,10 +1267,18 @@ function $ff7feae4dddd6073$export$791ef57e62e21c3f(_ref) {
1260
1267
  set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
1261
1268
  });
1262
1269
 
1263
- return $b8hua$createMemo(() => $ff7feae4dddd6073$export$92aa5d691d588f3f({
1270
+ const remapped_ = $b8hua$createMemo(() => $ff7feae4dddd6073$export$92aa5d691d588f3f({
1264
1271
  wrapped_blocks_: get_wrapped_blocks_(),
1265
1272
  n_cols_currently_showing_: n_cols_currently_showing_()
1266
- }).content_blocks_by_index_);
1273
+ }));
1274
+ const content_blocks_by_index_ = $b8hua$createMemo(() => remapped_().content_blocks_by_index_);
1275
+ return Object.assign(content_blocks_by_index_, {
1276
+ trailing_: product_count => $ff7feae4dddd6073$export$b94605e5b3ce01c({
1277
+ ...remapped_(),
1278
+ n_cols_currently_showing_: n_cols_currently_showing_(),
1279
+ product_count: product_count
1280
+ })
1281
+ });
1267
1282
  }
1268
1283
  function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
1269
1284
  let {
@@ -1272,13 +1287,16 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
1272
1287
  } = _ref2;
1273
1288
  // This computation should be quite cheap since it just moves around things into an array
1274
1289
  const content_blocks_by_index_ = [];
1290
+ const rows_by_index_ = []; // the row of each block at each index of content_blocks_by_index_, in the same order
1275
1291
  const constructed_block_arrays = new WeakSet();
1276
1292
  // Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
1277
1293
  const displaced_products_ = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
1278
1294
  if (!n_cols_currently_showing_)
1279
1295
  // Nope out of here if we don't know how many columns are showing
1280
1296
  return {
1281
- content_blocks_by_index_: content_blocks_by_index_
1297
+ content_blocks_by_index_: content_blocks_by_index_,
1298
+ rows_by_index_: rows_by_index_,
1299
+ displaced_products_: displaced_products_
1282
1300
  };
1283
1301
  for (let i = 0; i < wrapped_blocks_.length; i++) {
1284
1302
  // i = row to show at
@@ -1326,6 +1344,7 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
1326
1344
  content_blocks_by_index_[final_target_index] = array;
1327
1345
  }
1328
1346
  } else content_blocks_by_index_[final_target_index] = block_content;
1347
+ (rows_by_index_[final_target_index] || (rows_by_index_[final_target_index] = [])).push(i);
1329
1348
  // Update displacement
1330
1349
  for (let j = 0; j < span_rows; j++) {
1331
1350
  var _ref3;
@@ -1335,30 +1354,74 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
1335
1354
  }
1336
1355
  return {
1337
1356
  content_blocks_by_index_: content_blocks_by_index_,
1357
+ rows_by_index_: rows_by_index_,
1338
1358
  displaced_products_: displaced_products_
1339
1359
  };
1340
1360
  }
1341
- /**
1342
- * Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
1343
- * Then renders the content and wraps it into a div with the correct styling.
1344
- * Also caps span_columns to max available columns
1345
- */
1361
+ function $ff7feae4dddd6073$export$b94605e5b3ce01c(_ref4) {
1362
+ let {
1363
+ content_blocks_by_index_: content_blocks_by_index_,
1364
+ rows_by_index_: rows_by_index_,
1365
+ displaced_products_: displaced_products_,
1366
+ n_cols_currently_showing_: n_cols_currently_showing_,
1367
+ product_count: product_count
1368
+ } = _ref4;
1369
+ const trailing = [];
1370
+ if (!n_cols_currently_showing_ || product_count <= 0) return trailing;
1371
+ // Find the row the last product lands in: each row has room for the columns that blocks don't take up
1372
+ let last_product_row = 0;
1373
+ let last_product_row_is_full = false;
1374
+ for (let seen_products = 0;; last_product_row++) {
1375
+ const row = displaced_products_[last_product_row];
1376
+ const taken_by_blocks = typeof row === "number" ? row : row ? row.filter(item => item).length : 0;
1377
+ const product_slots_in_row = Math.max(0, n_cols_currently_showing_ - taken_by_blocks);
1378
+ if (seen_products + product_slots_in_row >= product_count) {
1379
+ last_product_row_is_full = seen_products + product_slots_in_row === product_count;
1380
+ break;
1381
+ }
1382
+ seen_products += product_slots_in_row;
1383
+ // Rows past the ones blocks take up all have room for products, so we're done by then at the latest
1384
+ if (last_product_row >= displaced_products_.length + product_count) break;
1385
+ }
1386
+ for (let i = product_count; i < content_blocks_by_index_.length; i++) {
1387
+ var _rows$;
1388
+ const block = content_blocks_by_index_[i];
1389
+ if (block === undefined) continue;
1390
+ const rows = rows_by_index_[i] || [];
1391
+ const last_allowed_row = last_product_row + (last_product_row_is_full ? 1 : 0);
1392
+ if (Array.isArray(block) && rows.length > 1) {
1393
+ // Several blocks can share this index. Keep only blocks in allowed trailing rows.
1394
+ const in_trailing_rows = block.filter((_, j) => rows[j] <= last_allowed_row);
1395
+ if (in_trailing_rows.length) trailing.push(in_trailing_rows);
1396
+ continue;
1397
+ }
1398
+ if (((_rows$ = rows[0]) !== null && _rows$ !== void 0 ? _rows$ : Infinity) > last_allowed_row) continue; // Keep cards meant for later rows hidden after filtering.
1399
+ trailing.push(block);
1400
+ }
1401
+ return trailing;
1402
+ }
1403
+ function $ff7feae4dddd6073$export$911278b0390ae36e(block, max_span_columns) {
1404
+ const span_columns = Math.min(block.span_columns, max_span_columns !== null && max_span_columns !== void 0 ? max_span_columns : Infinity);
1405
+ const spans_whole_row = span_columns === max_span_columns;
1406
+ return {
1407
+ span_columns: span_columns,
1408
+ span_rows: spans_whole_row ? 1 : block.span_rows,
1409
+ spans_whole_row: spans_whole_row
1410
+ };
1411
+ }
1346
1412
  function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
1347
1413
  const get_wrapped_blocks = $b8hua$mapArray(() => rendered_content_blocks, block => {
1348
1414
  if (!block) return;
1349
- const final_span_columns = $b8hua$createMemo(() => {
1350
- var _max_span_columns;
1351
- return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
1352
- });
1353
- // If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
1354
- const final_span_rows = $b8hua$createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
1415
+ const final_spans = $b8hua$createMemo(() => $ff7feae4dddd6073$export$911278b0390ae36e(block, max_span_columns()));
1416
+ const final_span_columns = $b8hua$createMemo(() => final_spans().span_columns);
1417
+ const final_span_rows = $b8hua$createMemo(() => final_spans().span_rows);
1355
1418
  const [rendering_delayed, set_rendering_delayed_] = $b8hua$createSignal(true);
1356
1419
  const content = $b8hua$createComponent((0, $b8hua$Show), {
1357
1420
  get when() {
1358
1421
  return !rendering_delayed();
1359
1422
  },
1360
1423
  get children() {
1361
- return $b8hua$ssr($ff7feae4dddd6073$var$_tmpl$, $b8hua$ssrHydrationKey(), "content-block-wrapper ".concat(final_span_columns() === max_span_columns() ? "spans-whole-row" : ""), "grid-column:" + "span ".concat($b8hua$escape(final_span_columns(), true)) + (";grid-row:" + "span ".concat($b8hua$escape(final_span_rows(), true))) + (";spans_columns_variable_name:" + $b8hua$escape(final_span_columns(), true)), $b8hua$escape($b8hua$createComponent($ff7feae4dddd6073$var$RenderContent, {
1424
+ return $b8hua$ssr($ff7feae4dddd6073$var$_tmpl$, $b8hua$ssrHydrationKey(), "content-block-wrapper ".concat(final_spans().spans_whole_row ? "spans-whole-row" : ""), "grid-column:" + "span ".concat($b8hua$escape(final_span_columns(), true)) + (";grid-row:" + "span ".concat($b8hua$escape(final_span_rows(), true))) + (";spans_columns_variable_name:" + $b8hua$escape(final_span_columns(), true)), $b8hua$escape($b8hua$createComponent($ff7feae4dddd6073$var$RenderContent, {
1362
1425
  get content() {
1363
1426
  return block.content;
1364
1427
  }
@@ -1370,6 +1433,7 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
1370
1433
  content: () => {
1371
1434
  // 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
1372
1435
  // 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
1436
+ // (or, once all products have loaded, ResultsProductCards renders the blocks placed after the last product)
1373
1437
  set_rendering_delayed_(false);
1374
1438
  return content;
1375
1439
  },