@depict-ai/ui 2.0.4 → 2.0.6

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.
@@ -8,7 +8,7 @@ import $b8hua$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
8
8
  /*! Depict.ai search and product listing SDK */
9
9
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
10
10
  register_es_version("ui", "ES10");
11
- const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0.4";
11
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0.6";
12
12
 
13
13
  /** @jsxImportSource solid-js */
14
14
 
@@ -1278,15 +1278,18 @@ function $b54fc842e721c9eb$export$430444115f70a734(_ref) {
1278
1278
  }
1279
1279
  })));
1280
1280
  }
1281
- const $1e7465a8ffa97f6c$var$_tmpl$ = ["<div", ' class="range"><div class="input-group"><div class="field"><input type="number"', '></div><div class="separator">-</div><div class="field"><input', ' type="number"', "></div></div><!--#-->", '<!--/--><div class="value-text"><span class="min"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", '<!--/--></span><span class="max"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span></div></div>"],
1281
+ const $1e7465a8ffa97f6c$var$_tmpl$ = ["<div", ' class="', '"><div class="input-group"><div class="field"><input', ' type="number"', '></div><div class="separator">-</div><div class="field"><input', ' type="number"', "></div></div><!--#-->", '<!--/--><div class="value-text"><span class="min"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", '<!--/--></span><span class="max"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span></div></div>"],
1282
1282
  $1e7465a8ffa97f6c$var$_tmpl$2 = ["<div", ' class="slider"><div class="progress" style="', '"></div></div>'],
1283
- $1e7465a8ffa97f6c$var$_tmpl$3 = ["<div", ' class="range-group"><input type="range"', ' step="any"><input', ' type="range"', ' step="any"></div>'];
1283
+ $1e7465a8ffa97f6c$var$_tmpl$3 = ["<div", ' class="range-group"><input', ' type="range"', ' step="any"><input', ' type="range"', ' step="any"></div>'];
1284
1284
  function $1e7465a8ffa97f6c$export$e0d834a0ad870cda(_ref) {
1285
1285
  let {
1286
1286
  filter_: filter_,
1287
1287
  selected_filters_: selected_filters_,
1288
1288
  i18n_: i18n_
1289
1289
  } = _ref;
1290
+ // If you ever attempt to implement that one can drag one range "knob" over the other like on prisjakt, see https://gitlab.com/depict-ai/depict.ai/-/merge_requests/8458/diffs?commit_id=c52dbdd15ca073489bee138b15d27bb6bf2992df
1291
+ // The issue with it is that one wants to discard the changes to the lower value as soon as the lower value has become the upper value when dragging the initially lower knob over the initially upper knob
1292
+ // But we can't reliably know when we've started dragging/changing the value (or at least I gave up at that point for now)
1290
1293
  const current_range = $b8hua$createSignal($b8hua$untrack(() => filter_().data));
1291
1294
  const selected_filter = $b8hua$createMemo(() => selected_filters_[0]().find(_ref2 => {
1292
1295
  let {
@@ -1356,11 +1359,13 @@ function $1e7465a8ffa97f6c$var$RangeSelector(_ref3) {
1356
1359
  const [get_current_range] = current_range_;
1357
1360
  const pre_price = $b8hua$createMemo(() => price_formatting_().pre_);
1358
1361
  const post_price = $b8hua$createMemo(() => price_formatting_().post_);
1359
- return $b8hua$ssr($1e7465a8ffa97f6c$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false) + $b8hua$ssrAttribute("value", $b8hua$escape(get_current_range()[0], true), false), $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_high_point_aria_label_(), true), false), $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false) + $b8hua$ssrAttribute("value", $b8hua$escape(get_current_range()[1], true), false), $b8hua$escape($b8hua$createComponent($1e7465a8ffa97f6c$var$ExponentialSlider, {
1362
+ const should_be_disabled_ = $b8hua$createMemo(() => Math.abs(min_() - max_()) < 2);
1363
+ return $b8hua$ssr($1e7465a8ffa97f6c$var$_tmpl$, $b8hua$ssrHydrationKey(), "range ".concat(min_() === max_() ? "disabled" : ""), $b8hua$ssrAttribute("disabled", should_be_disabled_(), true), $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false) + $b8hua$ssrAttribute("value", $b8hua$escape(get_current_range()[0], true), false), $b8hua$ssrAttribute("disabled", should_be_disabled_(), true) + $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_high_point_aria_label_(), true), false), $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false) + $b8hua$ssrAttribute("value", $b8hua$escape(get_current_range()[1], true), false), $b8hua$escape($b8hua$createComponent($1e7465a8ffa97f6c$var$ExponentialSlider, {
1360
1364
  max_: max_,
1361
1365
  min_: min_,
1362
1366
  current_range_: current_range_,
1363
- i18n_: i18n_
1367
+ i18n_: i18n_,
1368
+ should_be_disabled_: should_be_disabled_
1364
1369
  })), $b8hua$escape(pre_price()), $b8hua$escape($b8hua$createComponent((0, $60ec7a29849d81db$export$a71e92cfbb498adc), {
1365
1370
  get price_() {
1366
1371
  return min_();
@@ -1382,7 +1387,8 @@ function $1e7465a8ffa97f6c$var$ExponentialSlider(_ref4) {
1382
1387
  current_range_: current_range_,
1383
1388
  min_: min_,
1384
1389
  i18n_: i18n_,
1385
- max_: max_
1390
+ max_: max_,
1391
+ should_be_disabled_: should_be_disabled_
1386
1392
  } = _ref4;
1387
1393
  // inspired by https://observablehq.com/@mbostock/nonlinear-slider
1388
1394
  const transform_linear_to_nonlinear = _ref5 => {
@@ -1390,8 +1396,7 @@ function $1e7465a8ffa97f6c$var$ExponentialSlider(_ref4) {
1390
1396
  return [Math.sqrt(smaller), Math.sqrt(larger)];
1391
1397
  };
1392
1398
  const [read_current_range, write_current_range] = current_range_;
1393
- const modified_range = $b8hua$createSignal(transform_linear_to_nonlinear($b8hua$untrack(read_current_range)));
1394
- const [read_modified_range, write_modified_range] = modified_range;
1399
+ const modified_range_accessor = $b8hua$createMemo(() => transform_linear_to_nonlinear(read_current_range()));
1395
1400
  const modified_max = $b8hua$createMemo(() => Math.sqrt(max_()));
1396
1401
  const modified_min = $b8hua$createMemo(() => Math.sqrt(min_()));
1397
1402
  const offset_value_calculator_ = (value, how_many) => {
@@ -1399,42 +1404,49 @@ function $1e7465a8ffa97f6c$var$ExponentialSlider(_ref4) {
1399
1404
  const changed = number_in_linear + how_many;
1400
1405
  return Math.sqrt(changed);
1401
1406
  };
1402
- $b8hua$createComputed($b8hua$on(read_current_range, new_range_from_above => {
1403
- // to prevent from infinite looping, don't write if it's around the same
1404
- const new_modified_range = transform_linear_to_nonlinear(new_range_from_above);
1405
- const current_modified_range = read_modified_range();
1406
- if (!current_modified_range.every((item, index) => Math.round(item) === Math.round(new_modified_range[index]))) write_modified_range(new_modified_range);
1407
- }, {
1408
- defer: true
1409
- }));
1410
- $b8hua$createComputed($b8hua$on(read_modified_range, _ref6 => {
1411
- let [smaller, larger] = _ref6;
1412
- return write_current_range([Math.round(smaller * smaller), Math.round(larger * larger)]);
1413
- }, {
1414
- defer: true
1415
- }));
1407
+ const convert_back = (smaller, larger) => [Math.round(smaller * smaller), Math.round(larger * larger)];
1408
+ const modified_range_setter = new_range_or_function => {
1409
+ const old_range = $b8hua$untrack(modified_range_accessor);
1410
+ const new_range = typeof new_range_or_function === "function" ? new_range_or_function(old_range) : new_range_or_function;
1411
+ const [smaller, larger] = new_range;
1412
+ const [old_smaller, old_larger] = old_range;
1413
+ const new_range_converted = convert_back(smaller, larger);
1414
+ const old_range_converted = convert_back(old_smaller, old_larger);
1415
+ if (new_range_converted[0] === old_range_converted[0] && new_range_converted[1] === old_range_converted[1])
1416
+ // 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
1417
+ return new_range;
1418
+ write_current_range(new_range_converted);
1419
+ return new_range;
1420
+ };
1416
1421
  return $1e7465a8ffa97f6c$var$LinearSlider({
1417
- current_range_: modified_range,
1422
+ current_range_: [modified_range_accessor, modified_range_setter],
1423
+ // "Lie" to the actual slider so we don't have to implement exponential handling in there
1418
1424
  min_: modified_min,
1419
1425
  max_: modified_max,
1420
1426
  offset_value_calculator_: offset_value_calculator_,
1421
- i18n_: i18n_
1427
+ i18n_: i18n_,
1428
+ should_be_disabled_: should_be_disabled_
1422
1429
  });
1423
1430
  }
1424
- function $1e7465a8ffa97f6c$var$LinearSlider(_ref7) {
1431
+ function $1e7465a8ffa97f6c$var$LinearSlider(_ref6) {
1425
1432
  let {
1426
1433
  max_: max_,
1427
1434
  min_: min_,
1428
1435
  current_range_: current_range_,
1429
1436
  offset_value_calculator_: offset_value_calculator_,
1430
- i18n_: i18n_
1431
- } = _ref7;
1437
+ i18n_: i18n_,
1438
+ should_be_disabled_: should_be_disabled_
1439
+ } = _ref6;
1432
1440
  let range_input_1;
1433
1441
  let range_input_2;
1434
1442
  let clickable_slider;
1435
1443
  const [get_current_range, set_current_range] = current_range_;
1436
1444
  const progress_styling = $b8hua$createMemo(() => {
1437
- return "left:".concat(get_current_range()[0] / max_() * 100, "%;right:").concat(100 - get_current_range()[1] / max_() * 100, "%");
1445
+ const min = min_();
1446
+ const span = max_() - min;
1447
+ const [start, end] = get_current_range();
1448
+ if (should_be_disabled_()) return "left:50%;right:50%";
1449
+ return "left:".concat((start - min) / span * 100, "%;right:").concat(100 - (end - min) / span * 100, "%");
1438
1450
  });
1439
1451
  const set_value = (el, index) => {
1440
1452
  // initially I set the value on the elements by just having value={get_current_range()[0]}
@@ -1447,13 +1459,13 @@ function $1e7465a8ffa97f6c$var$LinearSlider(_ref7) {
1447
1459
  el.value = get_current_range()[index];
1448
1460
  });
1449
1461
  };
1450
- return [$b8hua$ssr($1e7465a8ffa97f6c$var$_tmpl$2, $b8hua$ssrHydrationKey(), $b8hua$ssrStyle(progress_styling())), $b8hua$ssr($1e7465a8ffa97f6c$var$_tmpl$3, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false) + $b8hua$ssrAttribute("value", $b8hua$escape($b8hua$createMemo(() => {
1462
+ return [$b8hua$ssr($1e7465a8ffa97f6c$var$_tmpl$2, $b8hua$ssrHydrationKey(), $b8hua$ssrStyle(progress_styling())), $b8hua$ssr($1e7465a8ffa97f6c$var$_tmpl$3, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("disabled", should_be_disabled_(), true), $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false) + $b8hua$ssrAttribute("value", $b8hua$escape($b8hua$createMemo(() => {
1451
1463
  min_();
1452
1464
  max_();
1453
1465
  return get_current_range()[0];
1454
1466
  }, undefined, {
1455
1467
  equals: false
1456
- })(), true), false), $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_high_point_aria_label_(), true), false), $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false))];
1468
+ })(), true), false), $b8hua$ssrAttribute("disabled", should_be_disabled_(), true) + $b8hua$ssrAttribute("aria-label", $b8hua$escape(i18n_.range_filter_high_point_aria_label_(), true), false), $b8hua$ssrAttribute("min", $b8hua$escape(min_(), true), false) + $b8hua$ssrAttribute("max", $b8hua$escape(max_(), true), false))];
1457
1469
  }
1458
1470
  function $1e7465a8ffa97f6c$var$set_range_with_sanitation(min_, max_, current_range_signal, index, target_el) {
1459
1471
  let get_offset_value = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : (value, how_many) => value + how_many;
@@ -1722,44 +1734,47 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
1722
1734
  return has_expandable();
1723
1735
  },
1724
1736
  get children() {
1725
- return $b8hua$createComponent((0, $ad371564683947ab$export$6c6d7a51fa9aa15d), {
1726
- get details_() {
1727
- return $b8hua$ssr($0ae614c5c7babb43$var$_tmpl$3, $b8hua$ssrHydrationKey());
1728
- },
1729
- get summary_() {
1730
- var _value10, _value11;
1731
- return $b8hua$ssr($0ae614c5c7babb43$var$_tmpl$4, $b8hua$ssrHydrationKey(), "count ".concat(((_value10 = value()) === null || _value10 === void 0 ? void 0 : _value10.count_) === 0 ? "count-0" : ""), $b8hua$escape((_value11 = value()) === null || _value11 === void 0 ? void 0 : _value11.count_), $b8hua$escape($b8hua$createComponent((0, $457279ff15864cb9$export$e5c2828934226505), {
1732
- i18n_: i18n_,
1733
- get expanded_() {
1734
- return $b8hua$createMemo(() => {
1735
- var _value$is_expanded_$u, _value12, _value12$is_expanded_, _value12$is_expanded_2;
1736
- return (_value$is_expanded_$u = (_value12 = value()) === null || _value12 === void 0 ? void 0 : (_value12$is_expanded_ = _value12.is_expanded_) === null || _value12$is_expanded_ === void 0 ? void 0 : (_value12$is_expanded_2 = _value12$is_expanded_.ui_should_show_expanded_) === null || _value12$is_expanded_2 === void 0 ? void 0 : _value12$is_expanded_2.call(_value12$is_expanded_)) !== null && _value$is_expanded_$u !== void 0 ? _value$is_expanded_$u : false;
1737
- });
1737
+ return (() => {
1738
+ const is_open = $b8hua$createMemo(() => {
1739
+ const v = value();
1740
+ if (!v)
1741
+ // only to prevent cleanup errors
1742
+ return $b8hua$createSignal(false);
1743
+ const {
1744
+ is_expanded_: {
1745
+ ui_should_show_expanded_: ui_should_show_expanded_,
1746
+ set_user_expanded_: set_user_expanded_
1738
1747
  }
1739
- })));
1740
- },
1741
- get is_open_() {
1742
- return $b8hua$createMemo(() => {
1743
- const v = value();
1744
- if (!v)
1745
- // only to prevent cleanup errors
1746
- return $b8hua$createSignal(false);
1747
- const {
1748
- is_expanded_: {
1749
- ui_should_show_expanded_: ui_should_show_expanded_,
1750
- set_user_expanded_: set_user_expanded_
1748
+ } = v;
1749
+ return [ui_should_show_expanded_, set_user_expanded_];
1750
+ });
1751
+ return $b8hua$createComponent((0, $ad371564683947ab$export$6c6d7a51fa9aa15d), {
1752
+ get details_() {
1753
+ return $b8hua$ssr($0ae614c5c7babb43$var$_tmpl$3, $b8hua$ssrHydrationKey());
1754
+ },
1755
+ get summary_() {
1756
+ var _value10, _value11;
1757
+ return $b8hua$ssr($0ae614c5c7babb43$var$_tmpl$4, $b8hua$ssrHydrationKey(), "count ".concat(((_value10 = value()) === null || _value10 === void 0 ? void 0 : _value10.count_) === 0 ? "count-0" : ""), $b8hua$escape((_value11 = value()) === null || _value11 === void 0 ? void 0 : _value11.count_), $b8hua$escape($b8hua$createComponent((0, $457279ff15864cb9$export$e5c2828934226505), {
1758
+ i18n_: i18n_,
1759
+ get expanded_() {
1760
+ return $b8hua$createMemo(() => {
1761
+ var _value$is_expanded_$u, _value12, _value12$is_expanded_, _value12$is_expanded_2;
1762
+ return (_value$is_expanded_$u = (_value12 = value()) === null || _value12 === void 0 ? void 0 : (_value12$is_expanded_ = _value12.is_expanded_) === null || _value12$is_expanded_ === void 0 ? void 0 : (_value12$is_expanded_2 = _value12$is_expanded_.ui_should_show_expanded_) === null || _value12$is_expanded_2 === void 0 ? void 0 : _value12$is_expanded_2.call(_value12$is_expanded_)) !== null && _value$is_expanded_$u !== void 0 ? _value$is_expanded_$u : false;
1763
+ });
1751
1764
  }
1752
- } = v;
1753
- return [ui_should_show_expanded_, set_user_expanded_];
1754
- })();
1755
- },
1756
- get children() {
1757
- return $0ae614c5c7babb43$var$render_stuff($b8hua$createMemo(() => {
1758
- var _value13;
1759
- return ((_value13 = value()) === null || _value13 === void 0 ? void 0 : _value13.children_) || {};
1760
- }), existing_filter, i18n_);
1761
- }
1762
- });
1765
+ })));
1766
+ },
1767
+ get is_open_() {
1768
+ return is_open();
1769
+ },
1770
+ get children() {
1771
+ return $0ae614c5c7babb43$var$render_stuff($b8hua$createMemo(() => {
1772
+ var _value13;
1773
+ return ((_value13 = value()) === null || _value13 === void 0 ? void 0 : _value13.children_) || {};
1774
+ }), existing_filter, i18n_);
1775
+ }
1776
+ });
1777
+ })();
1763
1778
  }
1764
1779
  })));
1765
1780
  })();
@@ -1824,7 +1839,7 @@ function $0ae614c5c7babb43$var$create_updating_signal(_ref3) {
1824
1839
  // wait for the children to have populated and us to have received the correct value_ and name_ values
1825
1840
  let updating_blocked = false;
1826
1841
  const index_of_us_in_selected_filter = existing_filter_ === null || existing_filter_ === void 0 ? void 0 : (_existing_filter_$dat = existing_filter_.data) === null || _existing_filter_$dat === void 0 ? void 0 : (_existing_filter_$dat2 = _existing_filter_$dat.findIndex) === null || _existing_filter_$dat2 === void 0 ? void 0 : _existing_filter_$dat2.call(_existing_filter_$dat, el => el.length === self_.value_.length && el.every((sub_el, index) => self_.value_[index] === sub_el));
1827
- signal_.push(...$b8hua$createSignal(index_of_us_in_selected_filter >= 0 ? true : false));
1842
+ signal_.push(...$b8hua$createSignal(index_of_us_in_selected_filter >= 0));
1828
1843
  const [read_checked, write_checked] = signal_;
1829
1844
  const child_objects = Object.values(self_.children_);
1830
1845
  const get_child_object_values = child_objects.map(_ref4 => {
@@ -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.4";
64
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.6";
65
65
 
66
66
  /** @jsxImportSource solid-js */
67
67
 
@@ -1251,14 +1251,17 @@ function $c1dc1554c1b94233$export$430444115f70a734({
1251
1251
  }
1252
1252
  })));
1253
1253
  }
1254
- const $0b7222ba8a8bb72f$var$_tmpl$ = ["<div", ' class="range"><div class="input-group"><div class="field"><input type="number"', '></div><div class="separator">-</div><div class="field"><input', ' type="number"', "></div></div><!--#-->", '<!--/--><div class="value-text"><span class="min"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", '<!--/--></span><span class="max"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span></div></div>"],
1254
+ const $0b7222ba8a8bb72f$var$_tmpl$ = ["<div", ' class="', '"><div class="input-group"><div class="field"><input', ' type="number"', '></div><div class="separator">-</div><div class="field"><input', ' type="number"', "></div></div><!--#-->", '<!--/--><div class="value-text"><span class="min"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", '<!--/--></span><span class="max"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span></div></div>"],
1255
1255
  $0b7222ba8a8bb72f$var$_tmpl$2 = ["<div", ' class="slider"><div class="progress" style="', '"></div></div>'],
1256
- $0b7222ba8a8bb72f$var$_tmpl$3 = ["<div", ' class="range-group"><input type="range"', ' step="any"><input', ' type="range"', ' step="any"></div>'];
1256
+ $0b7222ba8a8bb72f$var$_tmpl$3 = ["<div", ' class="range-group"><input', ' type="range"', ' step="any"><input', ' type="range"', ' step="any"></div>'];
1257
1257
  function $0b7222ba8a8bb72f$export$e0d834a0ad870cda({
1258
1258
  filter_: filter_,
1259
1259
  selected_filters_: selected_filters_,
1260
1260
  i18n_: i18n_
1261
1261
  }) {
1262
+ // If you ever attempt to implement that one can drag one range "knob" over the other like on prisjakt, see https://gitlab.com/depict-ai/depict.ai/-/merge_requests/8458/diffs?commit_id=c52dbdd15ca073489bee138b15d27bb6bf2992df
1263
+ // The issue with it is that one wants to discard the changes to the lower value as soon as the lower value has become the upper value when dragging the initially lower knob over the initially upper knob
1264
+ // But we can't reliably know when we've started dragging/changing the value (or at least I gave up at that point for now)
1262
1265
  const current_range = $5vyXB$solidjs.createSignal($5vyXB$solidjs.untrack(() => filter_().data));
1263
1266
  const selected_filter = $5vyXB$solidjs.createMemo(() => selected_filters_[0]().find(({
1264
1267
  field: checking_field,
@@ -1323,11 +1326,13 @@ function $0b7222ba8a8bb72f$var$RangeSelector({
1323
1326
  const [get_current_range] = current_range_;
1324
1327
  const pre_price = $5vyXB$solidjs.createMemo(() => price_formatting_().pre_);
1325
1328
  const post_price = $5vyXB$solidjs.createMemo(() => price_formatting_().post_);
1326
- return $5vyXB$solidjsweb.ssr($0b7222ba8a8bb72f$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("aria-label", $5vyXB$solidjsweb.escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("min", $5vyXB$solidjsweb.escape(min_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("max", $5vyXB$solidjsweb.escape(max_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("value", $5vyXB$solidjsweb.escape(get_current_range()[0], true), false), $5vyXB$solidjsweb.ssrAttribute("aria-label", $5vyXB$solidjsweb.escape(i18n_.range_filter_high_point_aria_label_(), true), false), $5vyXB$solidjsweb.ssrAttribute("min", $5vyXB$solidjsweb.escape(min_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("max", $5vyXB$solidjsweb.escape(max_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("value", $5vyXB$solidjsweb.escape(get_current_range()[1], true), false), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent($0b7222ba8a8bb72f$var$ExponentialSlider, {
1329
+ const should_be_disabled_ = $5vyXB$solidjs.createMemo(() => Math.abs(min_() - max_()) < 2);
1330
+ return $5vyXB$solidjsweb.ssr($0b7222ba8a8bb72f$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), `range ${min_() === max_() ? "disabled" : ""}`, $5vyXB$solidjsweb.ssrAttribute("disabled", should_be_disabled_(), true), $5vyXB$solidjsweb.ssrAttribute("aria-label", $5vyXB$solidjsweb.escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("min", $5vyXB$solidjsweb.escape(min_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("max", $5vyXB$solidjsweb.escape(max_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("value", $5vyXB$solidjsweb.escape(get_current_range()[0], true), false), $5vyXB$solidjsweb.ssrAttribute("disabled", should_be_disabled_(), true) + $5vyXB$solidjsweb.ssrAttribute("aria-label", $5vyXB$solidjsweb.escape(i18n_.range_filter_high_point_aria_label_(), true), false), $5vyXB$solidjsweb.ssrAttribute("min", $5vyXB$solidjsweb.escape(min_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("max", $5vyXB$solidjsweb.escape(max_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("value", $5vyXB$solidjsweb.escape(get_current_range()[1], true), false), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent($0b7222ba8a8bb72f$var$ExponentialSlider, {
1327
1331
  max_: max_,
1328
1332
  min_: min_,
1329
1333
  current_range_: current_range_,
1330
- i18n_: i18n_
1334
+ i18n_: i18n_,
1335
+ should_be_disabled_: should_be_disabled_
1331
1336
  })), $5vyXB$solidjsweb.escape(pre_price()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $d659702496cb72ea$export$a71e92cfbb498adc), {
1332
1337
  get price_() {
1333
1338
  return min_();
@@ -1348,13 +1353,13 @@ function $0b7222ba8a8bb72f$var$ExponentialSlider({
1348
1353
  current_range_: current_range_,
1349
1354
  min_: min_,
1350
1355
  i18n_: i18n_,
1351
- max_: max_
1356
+ max_: max_,
1357
+ should_be_disabled_: should_be_disabled_
1352
1358
  }) {
1353
1359
  // inspired by https://observablehq.com/@mbostock/nonlinear-slider
1354
1360
  const transform_linear_to_nonlinear = ([smaller, larger]) => [Math.sqrt(smaller), Math.sqrt(larger)];
1355
1361
  const [read_current_range, write_current_range] = current_range_;
1356
- const modified_range = $5vyXB$solidjs.createSignal(transform_linear_to_nonlinear($5vyXB$solidjs.untrack(read_current_range)));
1357
- const [read_modified_range, write_modified_range] = modified_range;
1362
+ const modified_range_accessor = $5vyXB$solidjs.createMemo(() => transform_linear_to_nonlinear(read_current_range()));
1358
1363
  const modified_max = $5vyXB$solidjs.createMemo(() => Math.sqrt(max_()));
1359
1364
  const modified_min = $5vyXB$solidjs.createMemo(() => Math.sqrt(min_()));
1360
1365
  const offset_value_calculator_ = (value, how_many) => {
@@ -1362,23 +1367,28 @@ function $0b7222ba8a8bb72f$var$ExponentialSlider({
1362
1367
  const changed = number_in_linear + how_many;
1363
1368
  return Math.sqrt(changed);
1364
1369
  };
1365
- $5vyXB$solidjs.createComputed($5vyXB$solidjs.on(read_current_range, new_range_from_above => {
1366
- // to prevent from infinite looping, don't write if it's around the same
1367
- const new_modified_range = transform_linear_to_nonlinear(new_range_from_above);
1368
- const current_modified_range = read_modified_range();
1369
- if (!current_modified_range.every((item, index) => Math.round(item) === Math.round(new_modified_range[index]))) write_modified_range(new_modified_range);
1370
- }, {
1371
- defer: true
1372
- }));
1373
- $5vyXB$solidjs.createComputed($5vyXB$solidjs.on(read_modified_range, ([smaller, larger]) => write_current_range([Math.round(smaller * smaller), Math.round(larger * larger)]), {
1374
- defer: true
1375
- }));
1370
+ const convert_back = (smaller, larger) => [Math.round(smaller * smaller), Math.round(larger * larger)];
1371
+ const modified_range_setter = new_range_or_function => {
1372
+ const old_range = $5vyXB$solidjs.untrack(modified_range_accessor);
1373
+ const new_range = typeof new_range_or_function === "function" ? new_range_or_function(old_range) : new_range_or_function;
1374
+ const [smaller, larger] = new_range;
1375
+ const [old_smaller, old_larger] = old_range;
1376
+ const new_range_converted = convert_back(smaller, larger);
1377
+ const old_range_converted = convert_back(old_smaller, old_larger);
1378
+ if (new_range_converted[0] === old_range_converted[0] && new_range_converted[1] === old_range_converted[1])
1379
+ // 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
1380
+ return new_range;
1381
+ write_current_range(new_range_converted);
1382
+ return new_range;
1383
+ };
1376
1384
  return $0b7222ba8a8bb72f$var$LinearSlider({
1377
- current_range_: modified_range,
1385
+ current_range_: [modified_range_accessor, modified_range_setter],
1386
+ // "Lie" to the actual slider so we don't have to implement exponential handling in there
1378
1387
  min_: modified_min,
1379
1388
  max_: modified_max,
1380
1389
  offset_value_calculator_: offset_value_calculator_,
1381
- i18n_: i18n_
1390
+ i18n_: i18n_,
1391
+ should_be_disabled_: should_be_disabled_
1382
1392
  });
1383
1393
  }
1384
1394
  function $0b7222ba8a8bb72f$var$LinearSlider({
@@ -1386,14 +1396,19 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
1386
1396
  min_: min_,
1387
1397
  current_range_: current_range_,
1388
1398
  offset_value_calculator_: offset_value_calculator_,
1389
- i18n_: i18n_
1399
+ i18n_: i18n_,
1400
+ should_be_disabled_: should_be_disabled_
1390
1401
  }) {
1391
1402
  let range_input_1;
1392
1403
  let range_input_2;
1393
1404
  let clickable_slider;
1394
1405
  const [get_current_range, set_current_range] = current_range_;
1395
1406
  const progress_styling = $5vyXB$solidjs.createMemo(() => {
1396
- return `left:${get_current_range()[0] / max_() * 100}%;right:${100 - get_current_range()[1] / max_() * 100}%`;
1407
+ const min = min_();
1408
+ const span = max_() - min;
1409
+ const [start, end] = get_current_range();
1410
+ if (should_be_disabled_()) return `left:50%;right:50%`;
1411
+ return `left:${(start - min) / span * 100}%;right:${100 - (end - min) / span * 100}%`;
1397
1412
  });
1398
1413
  const set_value = (el, index) => {
1399
1414
  // initially I set the value on the elements by just having value={get_current_range()[0]}
@@ -1406,13 +1421,13 @@ function $0b7222ba8a8bb72f$var$LinearSlider({
1406
1421
  el.value = get_current_range()[index];
1407
1422
  });
1408
1423
  };
1409
- return [$5vyXB$solidjsweb.ssr($0b7222ba8a8bb72f$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrStyle(progress_styling())), $5vyXB$solidjsweb.ssr($0b7222ba8a8bb72f$var$_tmpl$3, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("aria-label", $5vyXB$solidjsweb.escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("min", $5vyXB$solidjsweb.escape(min_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("max", $5vyXB$solidjsweb.escape(max_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("value", $5vyXB$solidjsweb.escape($5vyXB$solidjs.createMemo(() => {
1424
+ return [$5vyXB$solidjsweb.ssr($0b7222ba8a8bb72f$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrStyle(progress_styling())), $5vyXB$solidjsweb.ssr($0b7222ba8a8bb72f$var$_tmpl$3, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("disabled", should_be_disabled_(), true), $5vyXB$solidjsweb.ssrAttribute("aria-label", $5vyXB$solidjsweb.escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("min", $5vyXB$solidjsweb.escape(min_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("max", $5vyXB$solidjsweb.escape(max_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("value", $5vyXB$solidjsweb.escape($5vyXB$solidjs.createMemo(() => {
1410
1425
  min_();
1411
1426
  max_();
1412
1427
  return get_current_range()[0];
1413
1428
  }, undefined, {
1414
1429
  equals: false
1415
- })(), true), false), $5vyXB$solidjsweb.ssrAttribute("aria-label", $5vyXB$solidjsweb.escape(i18n_.range_filter_high_point_aria_label_(), true), false), $5vyXB$solidjsweb.ssrAttribute("min", $5vyXB$solidjsweb.escape(min_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("max", $5vyXB$solidjsweb.escape(max_(), true), false))];
1430
+ })(), true), false), $5vyXB$solidjsweb.ssrAttribute("disabled", should_be_disabled_(), true) + $5vyXB$solidjsweb.ssrAttribute("aria-label", $5vyXB$solidjsweb.escape(i18n_.range_filter_high_point_aria_label_(), true), false), $5vyXB$solidjsweb.ssrAttribute("min", $5vyXB$solidjsweb.escape(min_(), true), false) + $5vyXB$solidjsweb.ssrAttribute("max", $5vyXB$solidjsweb.escape(max_(), true), false))];
1416
1431
  }
1417
1432
  function $0b7222ba8a8bb72f$var$set_range_with_sanitation(min_, max_, current_range_signal, index, target_el, get_offset_value = (value, how_many) => value + how_many) {
1418
1433
  let value_as_number = +target_el.value;
@@ -1661,37 +1676,40 @@ function $3bdc00a1353c1150$var$render_stuff(data, existing_filter, i18n_) {
1661
1676
  return has_expandable();
1662
1677
  },
1663
1678
  get children() {
1664
- return $5vyXB$solidjsweb.createComponent((0, $a69e505a12a77874$export$6c6d7a51fa9aa15d), {
1665
- get details_() {
1666
- return $5vyXB$solidjsweb.ssr($3bdc00a1353c1150$var$_tmpl$3, $5vyXB$solidjsweb.ssrHydrationKey());
1667
- },
1668
- get summary_() {
1669
- return $5vyXB$solidjsweb.ssr($3bdc00a1353c1150$var$_tmpl$4, $5vyXB$solidjsweb.ssrHydrationKey(), `count ${value()?.count_ === 0 ? "count-0" : ""}`, $5vyXB$solidjsweb.escape(value()?.count_), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $7567511a7c3e4bd7$export$e5c2828934226505), {
1670
- i18n_: i18n_,
1671
- get expanded_() {
1672
- return $5vyXB$solidjs.createMemo(() => value()?.is_expanded_?.ui_should_show_expanded_?.() ?? false);
1679
+ return (() => {
1680
+ const is_open = $5vyXB$solidjs.createMemo(() => {
1681
+ const v = value();
1682
+ if (!v)
1683
+ // only to prevent cleanup errors
1684
+ return $5vyXB$solidjs.createSignal(false);
1685
+ const {
1686
+ is_expanded_: {
1687
+ ui_should_show_expanded_: ui_should_show_expanded_,
1688
+ set_user_expanded_: set_user_expanded_
1673
1689
  }
1674
- })));
1675
- },
1676
- get is_open_() {
1677
- return $5vyXB$solidjs.createMemo(() => {
1678
- const v = value();
1679
- if (!v)
1680
- // only to prevent cleanup errors
1681
- return $5vyXB$solidjs.createSignal(false);
1682
- const {
1683
- is_expanded_: {
1684
- ui_should_show_expanded_: ui_should_show_expanded_,
1685
- set_user_expanded_: set_user_expanded_
1690
+ } = v;
1691
+ return [ui_should_show_expanded_, set_user_expanded_];
1692
+ });
1693
+ return $5vyXB$solidjsweb.createComponent((0, $a69e505a12a77874$export$6c6d7a51fa9aa15d), {
1694
+ get details_() {
1695
+ return $5vyXB$solidjsweb.ssr($3bdc00a1353c1150$var$_tmpl$3, $5vyXB$solidjsweb.ssrHydrationKey());
1696
+ },
1697
+ get summary_() {
1698
+ return $5vyXB$solidjsweb.ssr($3bdc00a1353c1150$var$_tmpl$4, $5vyXB$solidjsweb.ssrHydrationKey(), `count ${value()?.count_ === 0 ? "count-0" : ""}`, $5vyXB$solidjsweb.escape(value()?.count_), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $7567511a7c3e4bd7$export$e5c2828934226505), {
1699
+ i18n_: i18n_,
1700
+ get expanded_() {
1701
+ return $5vyXB$solidjs.createMemo(() => value()?.is_expanded_?.ui_should_show_expanded_?.() ?? false);
1686
1702
  }
1687
- } = v;
1688
- return [ui_should_show_expanded_, set_user_expanded_];
1689
- })();
1690
- },
1691
- get children() {
1692
- return $3bdc00a1353c1150$var$render_stuff($5vyXB$solidjs.createMemo(() => value()?.children_ || {}), existing_filter, i18n_);
1693
- }
1694
- });
1703
+ })));
1704
+ },
1705
+ get is_open_() {
1706
+ return is_open();
1707
+ },
1708
+ get children() {
1709
+ return $3bdc00a1353c1150$var$render_stuff($5vyXB$solidjs.createMemo(() => value()?.children_ || {}), existing_filter, i18n_);
1710
+ }
1711
+ });
1712
+ })();
1695
1713
  }
1696
1714
  })));
1697
1715
  })();
@@ -1754,7 +1772,7 @@ function $3bdc00a1353c1150$var$create_updating_signal({
1754
1772
  // wait for the children to have populated and us to have received the correct value_ and name_ values
1755
1773
  let updating_blocked = false;
1756
1774
  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));
1757
- signal_.push(...$5vyXB$solidjs.createSignal(index_of_us_in_selected_filter >= 0 ? true : false));
1775
+ signal_.push(...$5vyXB$solidjs.createSignal(index_of_us_in_selected_filter >= 0));
1758
1776
  const [read_checked, write_checked] = signal_;
1759
1777
  const child_objects = Object.values(self_.children_);
1760
1778
  const get_child_object_values = child_objects.map(({
@@ -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.4";
10
+ export const version = "2.0.6";
11
11
  /**
12
12
  * Returns accessor with the size of the provided element, including padding and border (I think)
13
13
  */