@depict-ai/ui 2.0.5 → 2.0.7

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.cjs CHANGED
@@ -61,7 +61,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
61
61
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
62
62
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
63
63
  /*! Depict.ai search and product listing SDK */
64
- const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.5";
64
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.7";
65
65
 
66
66
  /** @jsxImportSource solid-js */
67
67
 
@@ -112,27 +112,6 @@ const $4e04be41243c3d80$export$6daf8749b65a1b77 = cols_at_size => {
112
112
  });
113
113
  return $4e04be41243c3d80$var$transform_elements(sorted_cols_at_size);
114
114
  };
115
-
116
- /**
117
- * Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
118
- */
119
- function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
120
- if (!sdk_cols_at_size.length) return sdk_cols_at_size;
121
- const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
122
- const [[, smallest_max_width]] = sorted_sizes;
123
- if (smallest_max_width > min_width_for_more_than_one_column)
124
- // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
125
- return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
126
- const to_delete = [];
127
- for (let i = 0; i < sorted_sizes.length; i++) {
128
- const [, max_width] = sorted_sizes[i];
129
- if (max_width > min_width_for_more_than_one_column) continue;
130
- to_delete.push(i);
131
- }
132
- while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
133
- sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
134
- return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
135
- }
136
115
  function $fc23d7668ae0011d$export$a2cc176055f8f08() {
137
116
  const text = "Please try setting `colsAtSize` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
138
117
  return (0, $gVhhF$solidjsweb.isServer) ? {
@@ -650,7 +629,7 @@ function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
650
629
  market_: () => props.market,
651
630
  merchant_: () => props.merchant,
652
631
  layout_options_: $gVhhF$solidjs.createMemo(() => ({
653
- cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
632
+ cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
654
633
  ...grid_spacing_override()
655
634
  }))
656
635
  }));
@@ -763,7 +742,7 @@ function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
763
742
  market_: () => props.market,
764
743
  merchant_: () => props.merchant,
765
744
  layout_options_: $gVhhF$solidjs.createMemo(() => ({
766
- cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
745
+ cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
767
746
  ...grid_spacing_override()
768
747
  }))
769
748
  }));
@@ -1807,6 +1786,7 @@ function $0b7222ba8a8bb72f$var$RangeSelector({
1807
1786
  const [get_current_range] = current_range_;
1808
1787
  const pre_price = $gVhhF$solidjs.createMemo(() => price_formatting_().pre_);
1809
1788
  const post_price = $gVhhF$solidjs.createMemo(() => price_formatting_().post_);
1789
+ const should_be_disabled_ = $gVhhF$solidjs.createMemo(() => Math.abs(min_() - max_()) < 2);
1810
1790
  return (() => {
1811
1791
  const _el$ = $gVhhF$solidjsweb.getNextElement($0b7222ba8a8bb72f$var$_tmpl$),
1812
1792
  _el$2 = _el$.firstChild,
@@ -1852,7 +1832,8 @@ function $0b7222ba8a8bb72f$var$RangeSelector({
1852
1832
  max_: max_,
1853
1833
  min_: min_,
1854
1834
  current_range_: current_range_,
1855
- i18n_: i18n_
1835
+ i18n_: i18n_,
1836
+ should_be_disabled_: should_be_disabled_
1856
1837
  }), _el$24, _co$7);
1857
1838
  $gVhhF$solidjsweb.insert(_el$9, pre_price, _el$11, _co$);
1858
1839
  $gVhhF$solidjsweb.insert(_el$9, $gVhhF$solidjsweb.createComponent((0, $d659702496cb72ea$export$a71e92cfbb498adc), {
@@ -1875,18 +1856,24 @@ function $0b7222ba8a8bb72f$var$RangeSelector({
1875
1856
  }), _el$20, _co$5);
1876
1857
  $gVhhF$solidjsweb.insert(_el$16, post_price, _el$22, _co$6);
1877
1858
  $gVhhF$solidjsweb.effect(_p$ => {
1878
- const _v$ = i18n_.range_filter_low_point_aria_label_(),
1879
- _v$2 = min_(),
1880
- _v$3 = max_(),
1881
- _v$4 = i18n_.range_filter_high_point_aria_label_(),
1882
- _v$5 = min_(),
1883
- _v$6 = max_();
1884
- _v$ !== _p$._v$ && $gVhhF$solidjsweb.setAttribute(_el$4, "aria-label", _p$._v$ = _v$);
1885
- _v$2 !== _p$._v$2 && $gVhhF$solidjsweb.setAttribute(_el$4, "min", _p$._v$2 = _v$2);
1886
- _v$3 !== _p$._v$3 && $gVhhF$solidjsweb.setAttribute(_el$4, "max", _p$._v$3 = _v$3);
1887
- _v$4 !== _p$._v$4 && $gVhhF$solidjsweb.setAttribute(_el$7, "aria-label", _p$._v$4 = _v$4);
1888
- _v$5 !== _p$._v$5 && $gVhhF$solidjsweb.setAttribute(_el$7, "min", _p$._v$5 = _v$5);
1889
- _v$6 !== _p$._v$6 && $gVhhF$solidjsweb.setAttribute(_el$7, "max", _p$._v$6 = _v$6);
1859
+ const _v$ = !!(min_() === max_()),
1860
+ _v$2 = should_be_disabled_(),
1861
+ _v$3 = i18n_.range_filter_low_point_aria_label_(),
1862
+ _v$4 = min_(),
1863
+ _v$5 = max_(),
1864
+ _v$6 = should_be_disabled_(),
1865
+ _v$7 = i18n_.range_filter_high_point_aria_label_(),
1866
+ _v$8 = min_(),
1867
+ _v$9 = max_();
1868
+ _v$ !== _p$._v$ && _el$.classList.toggle("disabled", _p$._v$ = _v$);
1869
+ _v$2 !== _p$._v$2 && (_el$4.disabled = _p$._v$2 = _v$2);
1870
+ _v$3 !== _p$._v$3 && $gVhhF$solidjsweb.setAttribute(_el$4, "aria-label", _p$._v$3 = _v$3);
1871
+ _v$4 !== _p$._v$4 && $gVhhF$solidjsweb.setAttribute(_el$4, "min", _p$._v$4 = _v$4);
1872
+ _v$5 !== _p$._v$5 && $gVhhF$solidjsweb.setAttribute(_el$4, "max", _p$._v$5 = _v$5);
1873
+ _v$6 !== _p$._v$6 && (_el$7.disabled = _p$._v$6 = _v$6);
1874
+ _v$7 !== _p$._v$7 && $gVhhF$solidjsweb.setAttribute(_el$7, "aria-label", _p$._v$7 = _v$7);
1875
+ _v$8 !== _p$._v$8 && $gVhhF$solidjsweb.setAttribute(_el$7, "min", _p$._v$8 = _v$8);
1876
+ _v$9 !== _p$._v$9 && $gVhhF$solidjsweb.setAttribute(_el$7, "max", _p$._v$9 = _v$9);
1890
1877
  return _p$;
1891
1878
  }, {
1892
1879
  _v$: undefined,
@@ -1894,7 +1881,10 @@ function $0b7222ba8a8bb72f$var$RangeSelector({
1894
1881
  _v$3: undefined,
1895
1882
  _v$4: undefined,
1896
1883
  _v$5: undefined,
1897
- _v$6: undefined
1884
+ _v$6: undefined,
1885
+ _v$7: undefined,
1886
+ _v$8: undefined,
1887
+ _v$9: undefined
1898
1888
  });
1899
1889
  $gVhhF$solidjsweb.effect(() => _el$4.value = get_current_range()[0]);
1900
1890
  $gVhhF$solidjsweb.effect(() => _el$7.value = get_current_range()[1]);
@@ -1906,13 +1896,13 @@ function $0b7222ba8a8bb72f$var$ExponentialSlider({
1906
1896
  current_range_: current_range_,
1907
1897
  min_: min_,
1908
1898
  i18n_: i18n_,
1909
- max_: max_
1899
+ max_: max_,
1900
+ should_be_disabled_: should_be_disabled_
1910
1901
  }) {
1911
1902
  // inspired by https://observablehq.com/@mbostock/nonlinear-slider
1912
1903
  const transform_linear_to_nonlinear = ([smaller, larger]) => [Math.sqrt(smaller), Math.sqrt(larger)];
1913
1904
  const [read_current_range, write_current_range] = current_range_;
1914
- const modified_range = $gVhhF$solidjs.createSignal(transform_linear_to_nonlinear($gVhhF$solidjs.untrack(read_current_range)));
1915
- const [read_modified_range, write_modified_range] = modified_range;
1905
+ const modified_range_accessor = $gVhhF$solidjs.createMemo(() => transform_linear_to_nonlinear(read_current_range()));
1916
1906
  const modified_max = $gVhhF$solidjs.createMemo(() => Math.sqrt(max_()));
1917
1907
  const modified_min = $gVhhF$solidjs.createMemo(() => Math.sqrt(min_()));
1918
1908
  const offset_value_calculator_ = (value, how_many) => {
@@ -1920,23 +1910,28 @@ function $0b7222ba8a8bb72f$var$ExponentialSlider({
1920
1910
  const changed = number_in_linear + how_many;
1921
1911
  return Math.sqrt(changed);
1922
1912
  };
1923
- $gVhhF$solidjs.createComputed($gVhhF$solidjs.on(read_current_range, new_range_from_above => {
1924
- // to prevent from infinite looping, don't write if it's around the same
1925
- const new_modified_range = transform_linear_to_nonlinear(new_range_from_above);
1926
- const current_modified_range = read_modified_range();
1927
- if (!current_modified_range.every((item, index) => Math.round(item) === Math.round(new_modified_range[index]))) write_modified_range(new_modified_range);
1928
- }, {
1929
- defer: true
1930
- }));
1931
- $gVhhF$solidjs.createComputed($gVhhF$solidjs.on(read_modified_range, ([smaller, larger]) => write_current_range([Math.round(smaller * smaller), Math.round(larger * larger)]), {
1932
- defer: true
1933
- }));
1913
+ const convert_back = (smaller, larger) => [Math.round(smaller * smaller), Math.round(larger * larger)];
1914
+ const modified_range_setter = new_range_or_function => {
1915
+ const old_range = $gVhhF$solidjs.untrack(modified_range_accessor);
1916
+ const new_range = typeof new_range_or_function === "function" ? new_range_or_function(old_range) : new_range_or_function;
1917
+ const [smaller, larger] = new_range;
1918
+ const [old_smaller, old_larger] = old_range;
1919
+ const new_range_converted = convert_back(smaller, larger);
1920
+ const old_range_converted = convert_back(old_smaller, old_larger);
1921
+ if (new_range_converted[0] === old_range_converted[0] && new_range_converted[1] === old_range_converted[1])
1922
+ // If the new value gets identical rounding errors to the old value when being converted back, don't write it to the signal since it would cause an infinite loop
1923
+ return new_range;
1924
+ write_current_range(new_range_converted);
1925
+ return new_range;
1926
+ };
1934
1927
  return $0b7222ba8a8bb72f$var$LinearSlider({
1935
- current_range_: modified_range,
1928
+ current_range_: [modified_range_accessor, modified_range_setter],
1929
+ // "Lie" to the actual slider so we don't have to implement exponential handling in there
1936
1930
  min_: modified_min,
1937
1931
  max_: modified_max,
1938
1932
  offset_value_calculator_: offset_value_calculator_,
1939
- i18n_: i18n_
1933
+ i18n_: i18n_,
1934
+ should_be_disabled_: should_be_disabled_
1940
1935
  });
1941
1936
  }
1942
1937
  function $0b7222ba8a8bb72f$var$LinearSlider({
@@ -1944,7 +1939,8 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
1944
1939
  min_: min_,
1945
1940
  current_range_: current_range_,
1946
1941
  offset_value_calculator_: offset_value_calculator_,
1947
- i18n_: i18n_
1942
+ i18n_: i18n_,
1943
+ should_be_disabled_: should_be_disabled_
1948
1944
  }) {
1949
1945
  let range_input_1;
1950
1946
  let range_input_2;
@@ -1954,6 +1950,7 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
1954
1950
  const min = min_();
1955
1951
  const span = max_() - min;
1956
1952
  const [start, end] = get_current_range();
1953
+ if (should_be_disabled_()) return `left:50%;right:50%`;
1957
1954
  return `left:${(start - min) / span * 100}%;right:${100 - (end - min) / span * 100}%`;
1958
1955
  });
1959
1956
  const set_value = (el, index) => {
@@ -2003,26 +2000,32 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
2003
2000
  }, _el$29);
2004
2001
  $gVhhF$solidjsweb.addEventListener(_el$29, "input", $gVhhF$depictaiutilishared.catchify(() => $0b7222ba8a8bb72f$var$set_range_with_sanitation(min_, max_, current_range_, 1, range_input_2, offset_value_calculator_)), true);
2005
2002
  $gVhhF$solidjsweb.effect(_p$ => {
2006
- const _v$7 = i18n_.range_filter_low_point_aria_label_(),
2007
- _v$8 = min_(),
2008
- _v$9 = max_(),
2009
- _v$10 = i18n_.range_filter_high_point_aria_label_(),
2010
- _v$11 = min_(),
2011
- _v$12 = max_();
2012
- _v$7 !== _p$._v$7 && $gVhhF$solidjsweb.setAttribute(_el$28, "aria-label", _p$._v$7 = _v$7);
2013
- _v$8 !== _p$._v$8 && $gVhhF$solidjsweb.setAttribute(_el$28, "min", _p$._v$8 = _v$8);
2014
- _v$9 !== _p$._v$9 && $gVhhF$solidjsweb.setAttribute(_el$28, "max", _p$._v$9 = _v$9);
2015
- _v$10 !== _p$._v$10 && $gVhhF$solidjsweb.setAttribute(_el$29, "aria-label", _p$._v$10 = _v$10);
2016
- _v$11 !== _p$._v$11 && $gVhhF$solidjsweb.setAttribute(_el$29, "min", _p$._v$11 = _v$11);
2017
- _v$12 !== _p$._v$12 && $gVhhF$solidjsweb.setAttribute(_el$29, "max", _p$._v$12 = _v$12);
2003
+ const _v$10 = should_be_disabled_(),
2004
+ _v$11 = i18n_.range_filter_low_point_aria_label_(),
2005
+ _v$12 = min_(),
2006
+ _v$13 = max_(),
2007
+ _v$14 = should_be_disabled_(),
2008
+ _v$15 = i18n_.range_filter_high_point_aria_label_(),
2009
+ _v$16 = min_(),
2010
+ _v$17 = max_();
2011
+ _v$10 !== _p$._v$10 && (_el$28.disabled = _p$._v$10 = _v$10);
2012
+ _v$11 !== _p$._v$11 && $gVhhF$solidjsweb.setAttribute(_el$28, "aria-label", _p$._v$11 = _v$11);
2013
+ _v$12 !== _p$._v$12 && $gVhhF$solidjsweb.setAttribute(_el$28, "min", _p$._v$12 = _v$12);
2014
+ _v$13 !== _p$._v$13 && $gVhhF$solidjsweb.setAttribute(_el$28, "max", _p$._v$13 = _v$13);
2015
+ _v$14 !== _p$._v$14 && (_el$29.disabled = _p$._v$14 = _v$14);
2016
+ _v$15 !== _p$._v$15 && $gVhhF$solidjsweb.setAttribute(_el$29, "aria-label", _p$._v$15 = _v$15);
2017
+ _v$16 !== _p$._v$16 && $gVhhF$solidjsweb.setAttribute(_el$29, "min", _p$._v$16 = _v$16);
2018
+ _v$17 !== _p$._v$17 && $gVhhF$solidjsweb.setAttribute(_el$29, "max", _p$._v$17 = _v$17);
2018
2019
  return _p$;
2019
2020
  }, {
2020
- _v$7: undefined,
2021
- _v$8: undefined,
2022
- _v$9: undefined,
2023
2021
  _v$10: undefined,
2024
2022
  _v$11: undefined,
2025
- _v$12: undefined
2023
+ _v$12: undefined,
2024
+ _v$13: undefined,
2025
+ _v$14: undefined,
2026
+ _v$15: undefined,
2027
+ _v$16: undefined,
2028
+ _v$17: undefined
2026
2029
  });
2027
2030
  $gVhhF$solidjsweb.effect(() => _el$28.value = $gVhhF$solidjs.createMemo(() => {
2028
2031
  min_();
@@ -2312,47 +2315,50 @@ function $3bdc00a1353c1150$var$render_stuff(data, existing_filter, i18n_) {
2312
2315
  return has_expandable();
2313
2316
  },
2314
2317
  get children() {
2315
- return $gVhhF$solidjsweb.createComponent((0, $a69e505a12a77874$export$6c6d7a51fa9aa15d), {
2316
- get details_() {
2317
- return $gVhhF$solidjsweb.getNextElement($3bdc00a1353c1150$var$_tmpl$3);
2318
- },
2319
- get summary_() {
2320
- return (() => {
2321
- const _el$12 = $gVhhF$solidjsweb.getNextElement($3bdc00a1353c1150$var$_tmpl$4),
2322
- _el$13 = _el$12.firstChild,
2323
- _el$14 = _el$13.firstChild,
2324
- _el$15 = _el$14.nextSibling,
2325
- [_el$16, _co$5] = $gVhhF$solidjsweb.getNextMarker(_el$15.nextSibling);
2326
- $gVhhF$solidjsweb.insert(_el$14, () => value()?.count_);
2327
- $gVhhF$solidjsweb.insert(_el$13, $gVhhF$solidjsweb.createComponent((0, $7567511a7c3e4bd7$export$e5c2828934226505), {
2328
- i18n_: i18n_,
2329
- get expanded_() {
2330
- return $gVhhF$solidjs.createMemo(() => value()?.is_expanded_?.ui_should_show_expanded_?.() ?? false);
2331
- }
2332
- }), _el$16, _co$5);
2333
- $gVhhF$solidjsweb.effect(() => _el$14.classList.toggle("count-0", !!(value()?.count_ === 0)));
2334
- return _el$12;
2335
- })();
2336
- },
2337
- get is_open_() {
2338
- return $gVhhF$solidjs.createMemo(() => {
2339
- const v = value();
2340
- if (!v)
2341
- // only to prevent cleanup errors
2342
- return $gVhhF$solidjs.createSignal(false);
2343
- const {
2344
- is_expanded_: {
2345
- ui_should_show_expanded_: ui_should_show_expanded_,
2346
- set_user_expanded_: set_user_expanded_
2347
- }
2348
- } = v;
2349
- return [ui_should_show_expanded_, set_user_expanded_];
2350
- })();
2351
- },
2352
- get children() {
2353
- return $3bdc00a1353c1150$var$render_stuff($gVhhF$solidjs.createMemo(() => value()?.children_ || {}), existing_filter, i18n_);
2354
- }
2355
- });
2318
+ return (() => {
2319
+ const is_open = $gVhhF$solidjs.createMemo(() => {
2320
+ const v = value();
2321
+ if (!v)
2322
+ // only to prevent cleanup errors
2323
+ return $gVhhF$solidjs.createSignal(false);
2324
+ const {
2325
+ is_expanded_: {
2326
+ ui_should_show_expanded_: ui_should_show_expanded_,
2327
+ set_user_expanded_: set_user_expanded_
2328
+ }
2329
+ } = v;
2330
+ return [ui_should_show_expanded_, set_user_expanded_];
2331
+ });
2332
+ return $gVhhF$solidjsweb.createComponent((0, $a69e505a12a77874$export$6c6d7a51fa9aa15d), {
2333
+ get details_() {
2334
+ return $gVhhF$solidjsweb.getNextElement($3bdc00a1353c1150$var$_tmpl$3);
2335
+ },
2336
+ get summary_() {
2337
+ return (() => {
2338
+ const _el$12 = $gVhhF$solidjsweb.getNextElement($3bdc00a1353c1150$var$_tmpl$4),
2339
+ _el$13 = _el$12.firstChild,
2340
+ _el$14 = _el$13.firstChild,
2341
+ _el$15 = _el$14.nextSibling,
2342
+ [_el$16, _co$5] = $gVhhF$solidjsweb.getNextMarker(_el$15.nextSibling);
2343
+ $gVhhF$solidjsweb.insert(_el$14, () => value()?.count_);
2344
+ $gVhhF$solidjsweb.insert(_el$13, $gVhhF$solidjsweb.createComponent((0, $7567511a7c3e4bd7$export$e5c2828934226505), {
2345
+ i18n_: i18n_,
2346
+ get expanded_() {
2347
+ return $gVhhF$solidjs.createMemo(() => value()?.is_expanded_?.ui_should_show_expanded_?.() ?? false);
2348
+ }
2349
+ }), _el$16, _co$5);
2350
+ $gVhhF$solidjsweb.effect(() => _el$14.classList.toggle("count-0", !!(value()?.count_ === 0)));
2351
+ return _el$12;
2352
+ })();
2353
+ },
2354
+ get is_open_() {
2355
+ return is_open();
2356
+ },
2357
+ get children() {
2358
+ return $3bdc00a1353c1150$var$render_stuff($gVhhF$solidjs.createMemo(() => value()?.children_ || {}), existing_filter, i18n_);
2359
+ }
2360
+ });
2361
+ })();
2356
2362
  }
2357
2363
  }), _el$10, _co$4);
2358
2364
  $gVhhF$solidjsweb.effect(() => _el$6.classList.toggle("expandable", !!has_expandable()));
@@ -2418,7 +2424,7 @@ function $3bdc00a1353c1150$var$create_updating_signal({
2418
2424
  // wait for the children to have populated and us to have received the correct value_ and name_ values
2419
2425
  let updating_blocked = false;
2420
2426
  const index_of_us_in_selected_filter = existing_filter_?.data?.findIndex?.(el => el.length === self_.value_.length && el.every((sub_el, index) => self_.value_[index] === sub_el));
2421
- signal_.push(...$gVhhF$solidjs.createSignal(index_of_us_in_selected_filter >= 0 ? true : false));
2427
+ signal_.push(...$gVhhF$solidjs.createSignal(index_of_us_in_selected_filter >= 0));
2422
2428
  const [read_checked, write_checked] = signal_;
2423
2429
  const child_objects = Object.values(self_.children_);
2424
2430
  const get_child_object_values = child_objects.map(({
@@ -10061,6 +10067,27 @@ function $d8e94ea381ab57fa$export$828dcdd425fd3231(aligner) {
10061
10067
  cleanup: cleanup
10062
10068
  };
10063
10069
  }
10070
+
10071
+ /**
10072
+ * Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
10073
+ */
10074
+ function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
10075
+ if (!sdk_cols_at_size.length) return sdk_cols_at_size;
10076
+ const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
10077
+ const [[, smallest_max_width]] = sorted_sizes;
10078
+ if (smallest_max_width > min_width_for_more_than_one_column)
10079
+ // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
10080
+ return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
10081
+ const to_delete = [];
10082
+ for (let i = 0; i < sorted_sizes.length; i++) {
10083
+ const [, max_width] = sorted_sizes[i];
10084
+ if (max_width > min_width_for_more_than_one_column) continue;
10085
+ to_delete.push(i);
10086
+ }
10087
+ while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
10088
+ sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
10089
+ return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
10090
+ }
10064
10091
  const $2c61e4cd8229c49a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp search"></div>`, 2);
10065
10092
  // We just pass page_url_creator to DepictAPI when we instantiate it, so don't allow it to be specified if api is already specified
10066
10093
  /**
package/latest/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/
7
7
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
8
8
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
9
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "2.0.5";
10
+ export const version = "2.0.7";
11
11
  /**
12
12
  * Returns accessor with the size of the provided element, including padding and border (I think)
13
13
  */