@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/ES10/index.cjs +81 -17
- package/ES10/index.d.ts +2 -4
- package/ES10/index.js +81 -17
- package/latest/index.cjs +78 -14
- package/latest/index.d.ts +2 -4
- package/latest/index.js +78 -14
- package/package.json +9 -4
- package/server/ES10/index.cjs +81 -17
- package/server/ES10/index.d.ts +2 -4
- package/server/ES10/index.js +81 -17
- package/server/latest/index.cjs +78 -14
- package/server/latest/index.d.ts +2 -4
- package/server/latest/index.js +78 -14
package/ES10/index.cjs
CHANGED
|
@@ -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.
|
|
118
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.10.24";
|
|
119
119
|
function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
|
|
120
120
|
const signal = $52FdA$solidjs.createSignal(false);
|
|
121
121
|
$52FdA$solidjs.onCleanup($52FdA$depictaiutilishared.javascript_media_query(media_query, _ref => {
|
|
@@ -1284,8 +1284,15 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
1284
1284
|
setFirstResultInViewport(Math.min(...intersecting) + 1); // +1 because we want to start counting at 1
|
|
1285
1285
|
setLastResultsInViewport(Math.max(...intersecting) + 1);
|
|
1286
1286
|
});
|
|
1287
|
-
|
|
1287
|
+
// 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
|
|
1288
|
+
const trailingContentBlocks_ = $52FdA$solidjs.createMemo(() => {
|
|
1289
|
+
var _content_blocks_, _content_blocks_$trai;
|
|
1290
|
+
if (!all_products_loaded_[0]()) return [];
|
|
1291
|
+
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)) || [];
|
|
1292
|
+
});
|
|
1293
|
+
return [renderedDisplays_, trailingContentBlocks_]; // Regarding the as unknown: https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
1288
1294
|
}
|
|
1295
|
+
|
|
1289
1296
|
var $6c2c739b113a8ddf$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div>`),
|
|
1290
1297
|
$6c2c739b113a8ddf$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<style type=text/css>`);
|
|
1291
1298
|
function $6c2c739b113a8ddf$export$d21e32dfedac04be(props) {
|
|
@@ -1658,10 +1665,18 @@ function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
|
|
|
1658
1665
|
set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
|
|
1659
1666
|
});
|
|
1660
1667
|
|
|
1661
|
-
|
|
1668
|
+
const remapped_ = $52FdA$solidjs.createMemo(() => $f8f375d6245ffff2$export$92aa5d691d588f3f({
|
|
1662
1669
|
wrapped_blocks_: get_wrapped_blocks_(),
|
|
1663
1670
|
n_cols_currently_showing_: n_cols_currently_showing_()
|
|
1664
|
-
})
|
|
1671
|
+
}));
|
|
1672
|
+
const content_blocks_by_index_ = $52FdA$solidjs.createMemo(() => remapped_().content_blocks_by_index_);
|
|
1673
|
+
return Object.assign(content_blocks_by_index_, {
|
|
1674
|
+
trailing_: product_count => $f8f375d6245ffff2$export$b94605e5b3ce01c({
|
|
1675
|
+
...remapped_(),
|
|
1676
|
+
n_cols_currently_showing_: n_cols_currently_showing_(),
|
|
1677
|
+
product_count: product_count
|
|
1678
|
+
})
|
|
1679
|
+
});
|
|
1665
1680
|
}
|
|
1666
1681
|
function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
|
|
1667
1682
|
let {
|
|
@@ -1670,13 +1685,16 @@ function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
|
|
|
1670
1685
|
} = _ref2;
|
|
1671
1686
|
// This computation should be quite cheap since it just moves around things into an array
|
|
1672
1687
|
const content_blocks_by_index_ = [];
|
|
1688
|
+
const rows_by_index_ = []; // the row of each block at each index of content_blocks_by_index_, in the same order
|
|
1673
1689
|
const constructed_block_arrays = new WeakSet();
|
|
1674
1690
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
1675
1691
|
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
|
|
1676
1692
|
if (!n_cols_currently_showing_)
|
|
1677
1693
|
// Nope out of here if we don't know how many columns are showing
|
|
1678
1694
|
return {
|
|
1679
|
-
content_blocks_by_index_: content_blocks_by_index_
|
|
1695
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
1696
|
+
rows_by_index_: rows_by_index_,
|
|
1697
|
+
displaced_products_: displaced_products_
|
|
1680
1698
|
};
|
|
1681
1699
|
for (let i = 0; i < wrapped_blocks_.length; i++) {
|
|
1682
1700
|
// i = row to show at
|
|
@@ -1724,6 +1742,7 @@ function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
|
|
|
1724
1742
|
content_blocks_by_index_[final_target_index] = array;
|
|
1725
1743
|
}
|
|
1726
1744
|
} else content_blocks_by_index_[final_target_index] = block_content;
|
|
1745
|
+
(rows_by_index_[final_target_index] || (rows_by_index_[final_target_index] = [])).push(i);
|
|
1727
1746
|
// Update displacement
|
|
1728
1747
|
for (let j = 0; j < span_rows; j++) {
|
|
1729
1748
|
var _ref3;
|
|
@@ -1733,23 +1752,67 @@ function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
|
|
|
1733
1752
|
}
|
|
1734
1753
|
return {
|
|
1735
1754
|
content_blocks_by_index_: content_blocks_by_index_,
|
|
1755
|
+
rows_by_index_: rows_by_index_,
|
|
1736
1756
|
displaced_products_: displaced_products_
|
|
1737
1757
|
};
|
|
1738
1758
|
}
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1759
|
+
function $f8f375d6245ffff2$export$b94605e5b3ce01c(_ref4) {
|
|
1760
|
+
let {
|
|
1761
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
1762
|
+
rows_by_index_: rows_by_index_,
|
|
1763
|
+
displaced_products_: displaced_products_,
|
|
1764
|
+
n_cols_currently_showing_: n_cols_currently_showing_,
|
|
1765
|
+
product_count: product_count
|
|
1766
|
+
} = _ref4;
|
|
1767
|
+
const trailing = [];
|
|
1768
|
+
if (!n_cols_currently_showing_ || product_count <= 0) return trailing;
|
|
1769
|
+
// Find the row the last product lands in: each row has room for the columns that blocks don't take up
|
|
1770
|
+
let last_product_row = 0;
|
|
1771
|
+
let last_product_row_is_full = false;
|
|
1772
|
+
for (let seen_products = 0;; last_product_row++) {
|
|
1773
|
+
const row = displaced_products_[last_product_row];
|
|
1774
|
+
const taken_by_blocks = typeof row === "number" ? row : row ? row.filter(item => item).length : 0;
|
|
1775
|
+
const product_slots_in_row = Math.max(0, n_cols_currently_showing_ - taken_by_blocks);
|
|
1776
|
+
if (seen_products + product_slots_in_row >= product_count) {
|
|
1777
|
+
last_product_row_is_full = seen_products + product_slots_in_row === product_count;
|
|
1778
|
+
break;
|
|
1779
|
+
}
|
|
1780
|
+
seen_products += product_slots_in_row;
|
|
1781
|
+
// Rows past the ones blocks take up all have room for products, so we're done by then at the latest
|
|
1782
|
+
if (last_product_row >= displaced_products_.length + product_count) break;
|
|
1783
|
+
}
|
|
1784
|
+
for (let i = product_count; i < content_blocks_by_index_.length; i++) {
|
|
1785
|
+
var _rows$;
|
|
1786
|
+
const block = content_blocks_by_index_[i];
|
|
1787
|
+
if (block === undefined) continue;
|
|
1788
|
+
const rows = rows_by_index_[i] || [];
|
|
1789
|
+
const last_allowed_row = last_product_row + (last_product_row_is_full ? 1 : 0);
|
|
1790
|
+
if (Array.isArray(block) && rows.length > 1) {
|
|
1791
|
+
// Several blocks can share this index. Keep only blocks in allowed trailing rows.
|
|
1792
|
+
const in_trailing_rows = block.filter((_, j) => rows[j] <= last_allowed_row);
|
|
1793
|
+
if (in_trailing_rows.length) trailing.push(in_trailing_rows);
|
|
1794
|
+
continue;
|
|
1795
|
+
}
|
|
1796
|
+
if (((_rows$ = rows[0]) !== null && _rows$ !== void 0 ? _rows$ : Infinity) > last_allowed_row) continue; // Keep cards meant for later rows hidden after filtering.
|
|
1797
|
+
trailing.push(block);
|
|
1798
|
+
}
|
|
1799
|
+
return trailing;
|
|
1800
|
+
}
|
|
1801
|
+
function $f8f375d6245ffff2$export$911278b0390ae36e(block, max_span_columns) {
|
|
1802
|
+
const span_columns = Math.min(block.span_columns, max_span_columns !== null && max_span_columns !== void 0 ? max_span_columns : Infinity);
|
|
1803
|
+
const spans_whole_row = span_columns === max_span_columns;
|
|
1804
|
+
return {
|
|
1805
|
+
span_columns: span_columns,
|
|
1806
|
+
span_rows: spans_whole_row ? 1 : block.span_rows,
|
|
1807
|
+
spans_whole_row: spans_whole_row
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1744
1810
|
function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
1745
1811
|
const get_wrapped_blocks = $52FdA$solidjs.mapArray(() => rendered_content_blocks, block => {
|
|
1746
1812
|
if (!block) return;
|
|
1747
|
-
const
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
});
|
|
1751
|
-
// 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
|
|
1752
|
-
const final_span_rows = $52FdA$solidjs.createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
1813
|
+
const final_spans = $52FdA$solidjs.createMemo(() => $f8f375d6245ffff2$export$911278b0390ae36e(block, max_span_columns()));
|
|
1814
|
+
const final_span_columns = $52FdA$solidjs.createMemo(() => final_spans().span_columns);
|
|
1815
|
+
const final_span_rows = $52FdA$solidjs.createMemo(() => final_spans().span_rows);
|
|
1753
1816
|
const [rendering_delayed, set_rendering_delayed_] = $52FdA$solidjs.createSignal(true);
|
|
1754
1817
|
const content = $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1755
1818
|
get when() {
|
|
@@ -1763,7 +1826,7 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
1763
1826
|
}
|
|
1764
1827
|
}));
|
|
1765
1828
|
$52FdA$solidjsweb.effect(_p$ => {
|
|
1766
|
-
var _v$ = !!(
|
|
1829
|
+
var _v$ = !!final_spans().spans_whole_row,
|
|
1767
1830
|
_v$2 = {
|
|
1768
1831
|
[(0, $830518481649feb1$export$c500183c31c2b22e)]: final_span_columns()
|
|
1769
1832
|
},
|
|
@@ -1788,6 +1851,7 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
1788
1851
|
content: () => {
|
|
1789
1852
|
// 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
|
|
1790
1853
|
// 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
|
|
1854
|
+
// (or, once all products have loaded, ResultsProductCards renders the blocks placed after the last product)
|
|
1791
1855
|
set_rendering_delayed_(false);
|
|
1792
1856
|
return content;
|
|
1793
1857
|
},
|
package/ES10/index.d.ts
CHANGED
|
@@ -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.
|
|
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 */
|
package/ES10/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import $8tj43$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.
|
|
13
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "4.10.24";
|
|
14
14
|
function $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query) {
|
|
15
15
|
const signal = $8tj43$createSignal(false);
|
|
16
16
|
$8tj43$onCleanup($8tj43$javascript_media_query(media_query, _ref => {
|
|
@@ -1179,8 +1179,15 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
1179
1179
|
setFirstResultInViewport(Math.min(...intersecting) + 1); // +1 because we want to start counting at 1
|
|
1180
1180
|
setLastResultsInViewport(Math.max(...intersecting) + 1);
|
|
1181
1181
|
});
|
|
1182
|
-
|
|
1182
|
+
// 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
|
|
1183
|
+
const trailingContentBlocks_ = $8tj43$createMemo(() => {
|
|
1184
|
+
var _content_blocks_, _content_blocks_$trai;
|
|
1185
|
+
if (!all_products_loaded_[0]()) return [];
|
|
1186
|
+
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)) || [];
|
|
1187
|
+
});
|
|
1188
|
+
return [renderedDisplays_, trailingContentBlocks_]; // Regarding the as unknown: https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
1183
1189
|
}
|
|
1190
|
+
|
|
1184
1191
|
var $63f1f8dbcd07d3b0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div>`),
|
|
1185
1192
|
$63f1f8dbcd07d3b0$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<style type=text/css>`);
|
|
1186
1193
|
function $63f1f8dbcd07d3b0$export$d21e32dfedac04be(props) {
|
|
@@ -1553,10 +1560,18 @@ function $ff7feae4dddd6073$export$791ef57e62e21c3f(_ref) {
|
|
|
1553
1560
|
set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
|
|
1554
1561
|
});
|
|
1555
1562
|
|
|
1556
|
-
|
|
1563
|
+
const remapped_ = $8tj43$createMemo(() => $ff7feae4dddd6073$export$92aa5d691d588f3f({
|
|
1557
1564
|
wrapped_blocks_: get_wrapped_blocks_(),
|
|
1558
1565
|
n_cols_currently_showing_: n_cols_currently_showing_()
|
|
1559
|
-
})
|
|
1566
|
+
}));
|
|
1567
|
+
const content_blocks_by_index_ = $8tj43$createMemo(() => remapped_().content_blocks_by_index_);
|
|
1568
|
+
return Object.assign(content_blocks_by_index_, {
|
|
1569
|
+
trailing_: product_count => $ff7feae4dddd6073$export$b94605e5b3ce01c({
|
|
1570
|
+
...remapped_(),
|
|
1571
|
+
n_cols_currently_showing_: n_cols_currently_showing_(),
|
|
1572
|
+
product_count: product_count
|
|
1573
|
+
})
|
|
1574
|
+
});
|
|
1560
1575
|
}
|
|
1561
1576
|
function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
|
|
1562
1577
|
let {
|
|
@@ -1565,13 +1580,16 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
|
|
|
1565
1580
|
} = _ref2;
|
|
1566
1581
|
// This computation should be quite cheap since it just moves around things into an array
|
|
1567
1582
|
const content_blocks_by_index_ = [];
|
|
1583
|
+
const rows_by_index_ = []; // the row of each block at each index of content_blocks_by_index_, in the same order
|
|
1568
1584
|
const constructed_block_arrays = new WeakSet();
|
|
1569
1585
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
1570
1586
|
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
|
|
1571
1587
|
if (!n_cols_currently_showing_)
|
|
1572
1588
|
// Nope out of here if we don't know how many columns are showing
|
|
1573
1589
|
return {
|
|
1574
|
-
content_blocks_by_index_: content_blocks_by_index_
|
|
1590
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
1591
|
+
rows_by_index_: rows_by_index_,
|
|
1592
|
+
displaced_products_: displaced_products_
|
|
1575
1593
|
};
|
|
1576
1594
|
for (let i = 0; i < wrapped_blocks_.length; i++) {
|
|
1577
1595
|
// i = row to show at
|
|
@@ -1619,6 +1637,7 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
|
|
|
1619
1637
|
content_blocks_by_index_[final_target_index] = array;
|
|
1620
1638
|
}
|
|
1621
1639
|
} else content_blocks_by_index_[final_target_index] = block_content;
|
|
1640
|
+
(rows_by_index_[final_target_index] || (rows_by_index_[final_target_index] = [])).push(i);
|
|
1622
1641
|
// Update displacement
|
|
1623
1642
|
for (let j = 0; j < span_rows; j++) {
|
|
1624
1643
|
var _ref3;
|
|
@@ -1628,23 +1647,67 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
|
|
|
1628
1647
|
}
|
|
1629
1648
|
return {
|
|
1630
1649
|
content_blocks_by_index_: content_blocks_by_index_,
|
|
1650
|
+
rows_by_index_: rows_by_index_,
|
|
1631
1651
|
displaced_products_: displaced_products_
|
|
1632
1652
|
};
|
|
1633
1653
|
}
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1654
|
+
function $ff7feae4dddd6073$export$b94605e5b3ce01c(_ref4) {
|
|
1655
|
+
let {
|
|
1656
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
1657
|
+
rows_by_index_: rows_by_index_,
|
|
1658
|
+
displaced_products_: displaced_products_,
|
|
1659
|
+
n_cols_currently_showing_: n_cols_currently_showing_,
|
|
1660
|
+
product_count: product_count
|
|
1661
|
+
} = _ref4;
|
|
1662
|
+
const trailing = [];
|
|
1663
|
+
if (!n_cols_currently_showing_ || product_count <= 0) return trailing;
|
|
1664
|
+
// Find the row the last product lands in: each row has room for the columns that blocks don't take up
|
|
1665
|
+
let last_product_row = 0;
|
|
1666
|
+
let last_product_row_is_full = false;
|
|
1667
|
+
for (let seen_products = 0;; last_product_row++) {
|
|
1668
|
+
const row = displaced_products_[last_product_row];
|
|
1669
|
+
const taken_by_blocks = typeof row === "number" ? row : row ? row.filter(item => item).length : 0;
|
|
1670
|
+
const product_slots_in_row = Math.max(0, n_cols_currently_showing_ - taken_by_blocks);
|
|
1671
|
+
if (seen_products + product_slots_in_row >= product_count) {
|
|
1672
|
+
last_product_row_is_full = seen_products + product_slots_in_row === product_count;
|
|
1673
|
+
break;
|
|
1674
|
+
}
|
|
1675
|
+
seen_products += product_slots_in_row;
|
|
1676
|
+
// Rows past the ones blocks take up all have room for products, so we're done by then at the latest
|
|
1677
|
+
if (last_product_row >= displaced_products_.length + product_count) break;
|
|
1678
|
+
}
|
|
1679
|
+
for (let i = product_count; i < content_blocks_by_index_.length; i++) {
|
|
1680
|
+
var _rows$;
|
|
1681
|
+
const block = content_blocks_by_index_[i];
|
|
1682
|
+
if (block === undefined) continue;
|
|
1683
|
+
const rows = rows_by_index_[i] || [];
|
|
1684
|
+
const last_allowed_row = last_product_row + (last_product_row_is_full ? 1 : 0);
|
|
1685
|
+
if (Array.isArray(block) && rows.length > 1) {
|
|
1686
|
+
// Several blocks can share this index. Keep only blocks in allowed trailing rows.
|
|
1687
|
+
const in_trailing_rows = block.filter((_, j) => rows[j] <= last_allowed_row);
|
|
1688
|
+
if (in_trailing_rows.length) trailing.push(in_trailing_rows);
|
|
1689
|
+
continue;
|
|
1690
|
+
}
|
|
1691
|
+
if (((_rows$ = rows[0]) !== null && _rows$ !== void 0 ? _rows$ : Infinity) > last_allowed_row) continue; // Keep cards meant for later rows hidden after filtering.
|
|
1692
|
+
trailing.push(block);
|
|
1693
|
+
}
|
|
1694
|
+
return trailing;
|
|
1695
|
+
}
|
|
1696
|
+
function $ff7feae4dddd6073$export$911278b0390ae36e(block, max_span_columns) {
|
|
1697
|
+
const span_columns = Math.min(block.span_columns, max_span_columns !== null && max_span_columns !== void 0 ? max_span_columns : Infinity);
|
|
1698
|
+
const spans_whole_row = span_columns === max_span_columns;
|
|
1699
|
+
return {
|
|
1700
|
+
span_columns: span_columns,
|
|
1701
|
+
span_rows: spans_whole_row ? 1 : block.span_rows,
|
|
1702
|
+
spans_whole_row: spans_whole_row
|
|
1703
|
+
};
|
|
1704
|
+
}
|
|
1639
1705
|
function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
1640
1706
|
const get_wrapped_blocks = $8tj43$mapArray(() => rendered_content_blocks, block => {
|
|
1641
1707
|
if (!block) return;
|
|
1642
|
-
const
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
});
|
|
1646
|
-
// 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
|
|
1647
|
-
const final_span_rows = $8tj43$createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
1708
|
+
const final_spans = $8tj43$createMemo(() => $ff7feae4dddd6073$export$911278b0390ae36e(block, max_span_columns()));
|
|
1709
|
+
const final_span_columns = $8tj43$createMemo(() => final_spans().span_columns);
|
|
1710
|
+
const final_span_rows = $8tj43$createMemo(() => final_spans().span_rows);
|
|
1648
1711
|
const [rendering_delayed, set_rendering_delayed_] = $8tj43$createSignal(true);
|
|
1649
1712
|
const content = $8tj43$createComponent((0, $8tj43$Show), {
|
|
1650
1713
|
get when() {
|
|
@@ -1658,7 +1721,7 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
1658
1721
|
}
|
|
1659
1722
|
}));
|
|
1660
1723
|
$8tj43$effect(_p$ => {
|
|
1661
|
-
var _v$ = !!(
|
|
1724
|
+
var _v$ = !!final_spans().spans_whole_row,
|
|
1662
1725
|
_v$2 = {
|
|
1663
1726
|
[(0, $64d94dcaa058dc7b$export$c500183c31c2b22e)]: final_span_columns()
|
|
1664
1727
|
},
|
|
@@ -1683,6 +1746,7 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
1683
1746
|
content: () => {
|
|
1684
1747
|
// 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
|
|
1685
1748
|
// 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
|
|
1749
|
+
// (or, once all products have loaded, ResultsProductCards renders the blocks placed after the last product)
|
|
1686
1750
|
set_rendering_delayed_(false);
|
|
1687
1751
|
return content;
|
|
1688
1752
|
},
|
package/latest/index.cjs
CHANGED
|
@@ -109,7 +109,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
|
|
|
109
109
|
$parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
|
|
110
110
|
$parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
|
|
111
111
|
/*! Depict.ai search and product listing SDK */
|
|
112
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.10.
|
|
112
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.10.24";
|
|
113
113
|
function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
|
|
114
114
|
const signal = $gVhhF$solidjs.createSignal(false);
|
|
115
115
|
$gVhhF$solidjs.onCleanup($gVhhF$depictaiutilishared.javascript_media_query(media_query, ({
|
|
@@ -1232,8 +1232,14 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
|
1232
1232
|
setFirstResultInViewport(Math.min(...intersecting) + 1); // +1 because we want to start counting at 1
|
|
1233
1233
|
setLastResultsInViewport(Math.max(...intersecting) + 1);
|
|
1234
1234
|
});
|
|
1235
|
-
|
|
1235
|
+
// 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
|
|
1236
|
+
const trailingContentBlocks_ = $gVhhF$solidjs.createMemo(() => {
|
|
1237
|
+
if (!all_products_loaded_[0]()) return [];
|
|
1238
|
+
return content_blocks_?.()?.trailing_?.(displays_by_key_().size) || [];
|
|
1239
|
+
});
|
|
1240
|
+
return [renderedDisplays_, trailingContentBlocks_]; // Regarding the as unknown: https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
1236
1241
|
}
|
|
1242
|
+
|
|
1237
1243
|
var $f48d0fbb00835aaa$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div>`),
|
|
1238
1244
|
$f48d0fbb00835aaa$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<style type=text/css>`);
|
|
1239
1245
|
function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
|
|
@@ -1583,10 +1589,18 @@ function $d92f338ba8f9da9b$export$791ef57e62e21c3f({
|
|
|
1583
1589
|
set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
|
|
1584
1590
|
});
|
|
1585
1591
|
|
|
1586
|
-
|
|
1592
|
+
const remapped_ = $gVhhF$solidjs.createMemo(() => $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
1587
1593
|
wrapped_blocks_: get_wrapped_blocks_(),
|
|
1588
1594
|
n_cols_currently_showing_: n_cols_currently_showing_()
|
|
1589
|
-
})
|
|
1595
|
+
}));
|
|
1596
|
+
const content_blocks_by_index_ = $gVhhF$solidjs.createMemo(() => remapped_().content_blocks_by_index_);
|
|
1597
|
+
return Object.assign(content_blocks_by_index_, {
|
|
1598
|
+
trailing_: product_count => $d92f338ba8f9da9b$export$b94605e5b3ce01c({
|
|
1599
|
+
...remapped_(),
|
|
1600
|
+
n_cols_currently_showing_: n_cols_currently_showing_(),
|
|
1601
|
+
product_count: product_count
|
|
1602
|
+
})
|
|
1603
|
+
});
|
|
1590
1604
|
}
|
|
1591
1605
|
function $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
1592
1606
|
wrapped_blocks_: wrapped_blocks_,
|
|
@@ -1594,13 +1608,16 @@ function $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
|
1594
1608
|
}) {
|
|
1595
1609
|
// This computation should be quite cheap since it just moves around things into an array
|
|
1596
1610
|
const content_blocks_by_index_ = [];
|
|
1611
|
+
const rows_by_index_ = []; // the row of each block at each index of content_blocks_by_index_, in the same order
|
|
1597
1612
|
const constructed_block_arrays = new WeakSet();
|
|
1598
1613
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
1599
1614
|
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
|
|
1600
1615
|
if (!n_cols_currently_showing_)
|
|
1601
1616
|
// Nope out of here if we don't know how many columns are showing
|
|
1602
1617
|
return {
|
|
1603
|
-
content_blocks_by_index_: content_blocks_by_index_
|
|
1618
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
1619
|
+
rows_by_index_: rows_by_index_,
|
|
1620
|
+
displaced_products_: displaced_products_
|
|
1604
1621
|
};
|
|
1605
1622
|
for (let i = 0; i < wrapped_blocks_.length; i++) {
|
|
1606
1623
|
// i = row to show at
|
|
@@ -1645,6 +1662,7 @@ function $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
|
1645
1662
|
content_blocks_by_index_[final_target_index] = array;
|
|
1646
1663
|
}
|
|
1647
1664
|
} else content_blocks_by_index_[final_target_index] = block_content;
|
|
1665
|
+
(rows_by_index_[final_target_index] ||= []).push(i);
|
|
1648
1666
|
// Update displacement
|
|
1649
1667
|
for (let j = 0; j < span_rows; j++) {
|
|
1650
1668
|
const row = displaced_products_[i + j] ||= [];
|
|
@@ -1653,20 +1671,65 @@ function $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
|
1653
1671
|
}
|
|
1654
1672
|
return {
|
|
1655
1673
|
content_blocks_by_index_: content_blocks_by_index_,
|
|
1674
|
+
rows_by_index_: rows_by_index_,
|
|
1656
1675
|
displaced_products_: displaced_products_
|
|
1657
1676
|
};
|
|
1658
1677
|
}
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1678
|
+
function $d92f338ba8f9da9b$export$b94605e5b3ce01c({
|
|
1679
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
1680
|
+
rows_by_index_: rows_by_index_,
|
|
1681
|
+
displaced_products_: displaced_products_,
|
|
1682
|
+
n_cols_currently_showing_: n_cols_currently_showing_,
|
|
1683
|
+
product_count: product_count
|
|
1684
|
+
}) {
|
|
1685
|
+
const trailing = [];
|
|
1686
|
+
if (!n_cols_currently_showing_ || product_count <= 0) return trailing;
|
|
1687
|
+
// Find the row the last product lands in: each row has room for the columns that blocks don't take up
|
|
1688
|
+
let last_product_row = 0;
|
|
1689
|
+
let last_product_row_is_full = false;
|
|
1690
|
+
for (let seen_products = 0;; last_product_row++) {
|
|
1691
|
+
const row = displaced_products_[last_product_row];
|
|
1692
|
+
const taken_by_blocks = typeof row === "number" ? row : row ? row.filter(item => item).length : 0;
|
|
1693
|
+
const product_slots_in_row = Math.max(0, n_cols_currently_showing_ - taken_by_blocks);
|
|
1694
|
+
if (seen_products + product_slots_in_row >= product_count) {
|
|
1695
|
+
last_product_row_is_full = seen_products + product_slots_in_row === product_count;
|
|
1696
|
+
break;
|
|
1697
|
+
}
|
|
1698
|
+
seen_products += product_slots_in_row;
|
|
1699
|
+
// Rows past the ones blocks take up all have room for products, so we're done by then at the latest
|
|
1700
|
+
if (last_product_row >= displaced_products_.length + product_count) break;
|
|
1701
|
+
}
|
|
1702
|
+
for (let i = product_count; i < content_blocks_by_index_.length; i++) {
|
|
1703
|
+
const block = content_blocks_by_index_[i];
|
|
1704
|
+
if (block === undefined) continue;
|
|
1705
|
+
const rows = rows_by_index_[i] || [];
|
|
1706
|
+
const last_allowed_row = last_product_row + (last_product_row_is_full ? 1 : 0);
|
|
1707
|
+
if (Array.isArray(block) && rows.length > 1) {
|
|
1708
|
+
// Several blocks can share this index. Keep only blocks in allowed trailing rows.
|
|
1709
|
+
const in_trailing_rows = block.filter((_, j) => rows[j] <= last_allowed_row);
|
|
1710
|
+
if (in_trailing_rows.length) trailing.push(in_trailing_rows);
|
|
1711
|
+
continue;
|
|
1712
|
+
}
|
|
1713
|
+
if ((rows[0] ?? Infinity) > last_allowed_row) continue; // Keep cards meant for later rows hidden after filtering.
|
|
1714
|
+
trailing.push(block);
|
|
1715
|
+
}
|
|
1716
|
+
return trailing;
|
|
1717
|
+
}
|
|
1718
|
+
function $d92f338ba8f9da9b$export$911278b0390ae36e(block, max_span_columns) {
|
|
1719
|
+
const span_columns = Math.min(block.span_columns, max_span_columns ?? Infinity);
|
|
1720
|
+
const spans_whole_row = span_columns === max_span_columns;
|
|
1721
|
+
return {
|
|
1722
|
+
span_columns: span_columns,
|
|
1723
|
+
span_rows: spans_whole_row ? 1 : block.span_rows,
|
|
1724
|
+
spans_whole_row: spans_whole_row
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1664
1727
|
function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
1665
1728
|
const get_wrapped_blocks = $gVhhF$solidjs.mapArray(() => rendered_content_blocks, block => {
|
|
1666
1729
|
if (!block) return;
|
|
1667
|
-
const
|
|
1668
|
-
|
|
1669
|
-
const final_span_rows = $gVhhF$solidjs.createMemo(() =>
|
|
1730
|
+
const final_spans = $gVhhF$solidjs.createMemo(() => $d92f338ba8f9da9b$export$911278b0390ae36e(block, max_span_columns()));
|
|
1731
|
+
const final_span_columns = $gVhhF$solidjs.createMemo(() => final_spans().span_columns);
|
|
1732
|
+
const final_span_rows = $gVhhF$solidjs.createMemo(() => final_spans().span_rows);
|
|
1670
1733
|
const [rendering_delayed, set_rendering_delayed_] = $gVhhF$solidjs.createSignal(true);
|
|
1671
1734
|
const content = $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
1672
1735
|
get when() {
|
|
@@ -1680,7 +1743,7 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
1680
1743
|
}
|
|
1681
1744
|
}));
|
|
1682
1745
|
$gVhhF$solidjsweb.effect(_p$ => {
|
|
1683
|
-
var _v$ = !!(
|
|
1746
|
+
var _v$ = !!final_spans().spans_whole_row,
|
|
1684
1747
|
_v$2 = {
|
|
1685
1748
|
[(0, $75777da1687ba3f6$export$c500183c31c2b22e)]: final_span_columns()
|
|
1686
1749
|
},
|
|
@@ -1705,6 +1768,7 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
1705
1768
|
content: () => {
|
|
1706
1769
|
// 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
|
|
1707
1770
|
// 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
|
|
1771
|
+
// (or, once all products have loaded, ResultsProductCards renders the blocks placed after the last product)
|
|
1708
1772
|
set_rendering_delayed_(false);
|
|
1709
1773
|
return content;
|
|
1710
1774
|
},
|
package/latest/index.d.ts
CHANGED
|
@@ -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.
|
|
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 */
|