@depict-ai/ui 2.0.20 → 2.0.22

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
@@ -66,7 +66,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
66
66
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
67
67
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
68
68
  /*! Depict.ai search and product listing SDK */
69
- const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.20";
69
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.22";
70
70
  const $84798aaa863a4909$var$ListingContext = /*@__PURE__*/$gVhhF$solidjs.createContext();
71
71
  function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
72
72
  const our_object = {};
@@ -1250,6 +1250,14 @@ function $c77c68e559a1506c$export$3b621d86b1566b2(props = {}) {
1250
1250
  return _el$;
1251
1251
  })();
1252
1252
  }
1253
+
1254
+ /**
1255
+ * Lower cases a string if possible. Mostly used to make the filter url values case-insensitive.
1256
+ */
1257
+ function $daa394359b026187$export$325f75597868c4f0(stuff) {
1258
+ if (typeof stuff !== "string") return stuff;
1259
+ return stuff.toLowerCase();
1260
+ }
1253
1261
  const $235a2771a44e28e9$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="clear-all-filters minor"></button>`, 2),
1254
1262
  $235a2771a44e28e9$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="inner"><span class="title"><!#><!/>: </span><!#><!/></div>`, 8),
1255
1263
  $235a2771a44e28e9$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="clear-filter major"><!#><!/><span><!#><!/><!#><!/><!#><!/> – <!#><!/><!#><!/><!#><!/></span></button>`, 18),
@@ -1335,7 +1343,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
1335
1343
  let parent_ = {};
1336
1344
  let created_an_object = false;
1337
1345
  for (let j = 0; j < value.length; j++) {
1338
- const this_categories_name = value[j];
1346
+ const this_categories_name = $daa394359b026187$export$325f75597868c4f0(value[j]);
1339
1347
  const obj = pointer[this_categories_name] ||= (() => {
1340
1348
  const value_as_string = value.map(v => typeof v === "number" ? v + "" : v); // don't think backend will ever send numbers but technically it's allowed;
1341
1349
  const created_obj = {
@@ -1439,7 +1447,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
1439
1447
  const index_of_us_in_meta = $gVhhF$solidjs.createMemo(() => {
1440
1448
  const sel_d = selected_data();
1441
1449
  return meta()?.values?.findIndex(value => {
1442
- return value === sel_d || Array.isArray(value) && Array.isArray(sel_d) && value.length === sel_d.length && value.every((item, index) => sel_d[index] === item);
1450
+ return $daa394359b026187$export$325f75597868c4f0(value) === $daa394359b026187$export$325f75597868c4f0(sel_d) || Array.isArray(value) && Array.isArray(sel_d) && value.length === sel_d.length && value.every((item, index) => $daa394359b026187$export$325f75597868c4f0(sel_d[index]) === $daa394359b026187$export$325f75597868c4f0(item));
1443
1451
  });
1444
1452
  });
1445
1453
  const name = $gVhhF$solidjs.createMemo(() => {
@@ -1453,7 +1461,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
1453
1461
  let we_in_structure;
1454
1462
  let pointer = structure;
1455
1463
  for (const step of selected_data()) {
1456
- we_in_structure = pointer?.[step];
1464
+ we_in_structure = pointer?.[$daa394359b026187$export$325f75597868c4f0(step)];
1457
1465
  pointer = we_in_structure?.children_;
1458
1466
  }
1459
1467
  return we_in_structure;
@@ -1464,7 +1472,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
1464
1472
  const siblings = parent?.children_;
1465
1473
  if (siblings) return [parent, ...Object.values(siblings)].every(({
1466
1474
  value_: value_
1467
- }) => iterable_selected_filter_data()?.some(v => Array.isArray(v) && v.length === value_.length && value_.every((val, index) => v[index] === val)));
1475
+ }) => iterable_selected_filter_data()?.some(v => Array.isArray(v) && v.length === value_.length && value_.every((val, index) => $daa394359b026187$export$325f75597868c4f0(v[index]) === $daa394359b026187$export$325f75597868c4f0(val))));
1468
1476
  return false;
1469
1477
  });
1470
1478
  return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
@@ -1486,7 +1494,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
1486
1494
  cloned_selected_filters.splice(index_in_selected_filters, 1);
1487
1495
  const data = filter().data;
1488
1496
  const cloned_data = Array.isArray(data) ? [...data] : [data];
1489
- const index_of_item = cloned_data.findIndex(item => item === to_remove);
1497
+ const index_of_item = cloned_data.findIndex(item => $daa394359b026187$export$325f75597868c4f0(item) === $daa394359b026187$export$325f75597868c4f0(to_remove));
1490
1498
  if (index_of_item >= 0) cloned_data.splice(index_of_item, 1);
1491
1499
  const in_structure = us_in_structure();
1492
1500
  if (in_structure) {
@@ -1497,7 +1505,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
1497
1505
  const {
1498
1506
  value_: value_
1499
1507
  } = kid;
1500
- const index_to_remove = cloned_data.findIndex(item => Array.isArray(item) && item.length === value_.length && value_.every((val, index) => item[index] === val));
1508
+ const index_to_remove = cloned_data.findIndex(item => Array.isArray(item) && item.length === value_.length && value_.every((val, index) => $daa394359b026187$export$325f75597868c4f0(item[index]) === $daa394359b026187$export$325f75597868c4f0(val)));
1501
1509
  if (index_to_remove >= 0) cloned_data.splice(index_to_remove, 1);
1502
1510
  recursive_kids.push(...Object.values(kid.children_));
1503
1511
  }
@@ -1676,6 +1684,11 @@ function $d94869c80e337a3d$export$dd948f91abc3a1c4({
1676
1684
  });
1677
1685
  const render_checkbox = checkbox => {
1678
1686
  // Checkbox always calls the getters in props, so we don't wrap these values into memos
1687
+ const is_checked = $gVhhF$solidjs.createMemo(() => {
1688
+ const data = existing_filter()?.data;
1689
+ const value = $daa394359b026187$export$325f75597868c4f0(checkbox().value_);
1690
+ return !!data?.some(item => $daa394359b026187$export$325f75597868c4f0(item) === value);
1691
+ });
1679
1692
  return $gVhhF$solidjsweb.createComponent((0, $1c63082b2da848ad$export$48513f6b9f8ce62d), {
1680
1693
  get value_() {
1681
1694
  return checkbox().value_;
@@ -1687,7 +1700,7 @@ function $d94869c80e337a3d$export$dd948f91abc3a1c4({
1687
1700
  return checkbox().count_;
1688
1701
  },
1689
1702
  get checked_() {
1690
- return existing_filter()?.data?.includes(checkbox().value_);
1703
+ return is_checked();
1691
1704
  }
1692
1705
  });
1693
1706
  };
@@ -1839,7 +1852,7 @@ function $c1dc1554c1b94233$export$430444115f70a734({
1839
1852
  $gVhhF$solidjsweb.effect(() => _el$4.checked = $gVhhF$solidjs.createMemo(() => {
1840
1853
  const v = value();
1841
1854
  const data = existing_filter()?.data;
1842
- if (data === v) return true;
1855
+ if ($daa394359b026187$export$325f75597868c4f0(data) === $daa394359b026187$export$325f75597868c4f0(v)) return true;
1843
1856
  return Array.isArray(data) && data.every((item, index) => item === v[index]);
1844
1857
  })());
1845
1858
  return _el$2;
@@ -2561,7 +2574,7 @@ function $3bdc00a1353c1150$var$create_updating_signal({
2561
2574
  const on_structure_complete_ = () => {
2562
2575
  // wait for the children to have populated and us to have received the correct value_ and name_ values
2563
2576
  let updating_blocked = false;
2564
- 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));
2577
+ const index_of_us_in_selected_filter = existing_filter_?.data?.findIndex?.(el => el.length === self_.value_.length && el.every((sub_el, index) => $daa394359b026187$export$325f75597868c4f0(self_.value_[index]) === $daa394359b026187$export$325f75597868c4f0(sub_el)));
2565
2578
  signal_.push(...$gVhhF$solidjs.createSignal(index_of_us_in_selected_filter >= 0));
2566
2579
  const [read_checked, write_checked] = signal_;
2567
2580
  const child_objects = Object.values(self_.children_);
@@ -2732,7 +2745,11 @@ const $0ef1681699140f1a$export$414f6a19d38e655c = ({
2732
2745
  return buttons();
2733
2746
  },
2734
2747
  children: value => {
2735
- const is_selected = $gVhhF$solidjs.createMemo(() => existing_filter()?.data?.includes(value().value_));
2748
+ const is_selected = $gVhhF$solidjs.createMemo(() => {
2749
+ const data = existing_filter()?.data;
2750
+ const current_value = $daa394359b026187$export$325f75597868c4f0(value().value_);
2751
+ return !!data?.some(item => $daa394359b026187$export$325f75597868c4f0(item) === current_value);
2752
+ });
2736
2753
  const MakeButton = attributes => (() => {
2737
2754
  const _el$2 = $gVhhF$solidjsweb.getNextElement($0ef1681699140f1a$var$_tmpl$3),
2738
2755
  _el$5 = _el$2.firstChild,
@@ -2767,7 +2784,10 @@ const $0ef1681699140f1a$export$414f6a19d38e655c = ({
2767
2784
  ...base_object,
2768
2785
  data: new_data
2769
2786
  };
2770
- if (!is_selected()) new_filter_object.data.push(value().value_);else new_filter_object.data = new_filter_object.data.filter(v => v !== value().value_);
2787
+ if (!is_selected()) new_filter_object.data.push(value().value_);else {
2788
+ const current_value_lower = $daa394359b026187$export$325f75597868c4f0(value().value_);
2789
+ new_filter_object.data = new_filter_object.data.filter(v => $daa394359b026187$export$325f75597868c4f0(v) !== current_value_lower);
2790
+ }
2771
2791
  const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
2772
2792
  set_selected_filters(selected_filters);
2773
2793
  });
@@ -2868,13 +2888,6 @@ function $0ef1681699140f1a$var$adjust_sizes(container_width, sizes, set_cols_at_
2868
2888
  overrides: column_to_row_result
2869
2889
  }]]);
2870
2890
  }
2871
- function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
2872
- const signal = $gVhhF$solidjs.createSignal(false);
2873
- $gVhhF$solidjs.onCleanup($gVhhF$depictaiutilishared.javascript_media_query(media_query, ({
2874
- matches: matches
2875
- }) => signal[1](matches)).remove);
2876
- return signal[0];
2877
- }
2878
2891
  const $b51a2b8b9355e66c$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<form class="checkbox-color"><!#><!/><!#><!/></form>`, 6);
2879
2892
  const $b51a2b8b9355e66c$var$max_visible_without_collapsing = 30;
2880
2893
  const $b51a2b8b9355e66c$var$show_non_collapsible_when_collapsed = 8;
@@ -2884,7 +2897,6 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
2884
2897
  i18n_: i18n_,
2885
2898
  view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_]
2886
2899
  }) {
2887
- const supports_hover = $b54e6192d0caa293$export$d9f36cf74e24d595("not all and (hover: none)");
2888
2900
  // same as in CheckboxFilter, maybe we should make this DRY at some point
2889
2901
  const existing_filter = $gVhhF$solidjs.createMemo(() => {
2890
2902
  const {
@@ -2912,6 +2924,11 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
2912
2924
  const hex_color = $gVhhF$solidjs.createMemo(() => checkbox().value_.split(";")?.[1] || "");
2913
2925
  const rgb_color = $gVhhF$solidjs.createMemo(() => $gVhhF$depictaiutilishared.hex_to_rgb(hex_color()));
2914
2926
  const black_contrast_better = $gVhhF$solidjs.createMemo(() => rgb_color() ? $b51a2b8b9355e66c$var$does_black_contrast_better(rgb_color()) : false);
2927
+ const is_checked = $gVhhF$solidjs.createMemo(() => {
2928
+ const data = existing_filter()?.data;
2929
+ const value = $daa394359b026187$export$325f75597868c4f0(checkbox().value_);
2930
+ return !!data?.some(item => $daa394359b026187$export$325f75597868c4f0(item) === value);
2931
+ });
2915
2932
  const input_row = $gVhhF$solidjsweb.createComponent((0, $1c63082b2da848ad$export$48513f6b9f8ce62d), {
2916
2933
  get value_() {
2917
2934
  return checkbox().value_;
@@ -2923,7 +2940,7 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
2923
2940
  return checkbox().count_;
2924
2941
  },
2925
2942
  get checked_() {
2926
- return existing_filter()?.data?.includes(checkbox().value_);
2943
+ return is_checked();
2927
2944
  },
2928
2945
  custom_indicator_ref: span => {
2929
2946
  const {
@@ -3106,7 +3123,7 @@ function $b064919833b3e80b$export$53c59af873b303c9({
3106
3123
  break try_specific;
3107
3124
  }
3108
3125
  const needle = data_is_array ? data[0] : data;
3109
- const index_in_meta = meta.values.findIndex(value => needle === value || Array.isArray(needle) && Array.isArray(value) && needle.length === value.length && value.every((item, index) => needle[index] === item));
3126
+ const index_in_meta = meta.values.findIndex(value => $daa394359b026187$export$325f75597868c4f0(needle) === $daa394359b026187$export$325f75597868c4f0(value) || Array.isArray(needle) && Array.isArray(value) && needle.length === value.length && value.every((item, index) => $daa394359b026187$export$325f75597868c4f0(needle[index]) === $daa394359b026187$export$325f75597868c4f0(item)));
3110
3127
  return meta.names?.[index_in_meta] || meta.values?.[index_in_meta];
3111
3128
  }
3112
3129
  }
@@ -3293,7 +3310,11 @@ function $aff9a96d30ed3563$var$ActualFilterBody(props) {
3293
3310
  return $gVhhF$solidjsweb.createComponent((0, $a69e505a12a77874$export$6c6d7a51fa9aa15d), {
3294
3311
  is_open_: is_open,
3295
3312
  get details_() {
3296
- return $gVhhF$solidjsweb.getNextElement($aff9a96d30ed3563$var$_tmpl$5);
3313
+ return (() => {
3314
+ const _el$15 = $gVhhF$solidjsweb.getNextElement($aff9a96d30ed3563$var$_tmpl$5);
3315
+ $gVhhF$solidjsweb.setAttribute(_el$15, "data-group-title", section_);
3316
+ return _el$15;
3317
+ })();
3297
3318
  },
3298
3319
  get summary_() {
3299
3320
  return (() => {
@@ -3660,7 +3681,8 @@ function $6e22b5314fb52f4c$export$e183a13865960371(params_to_default_value, rout
3660
3681
  const signals = {};
3661
3682
  const entries = Object.entries(params_to_default_value);
3662
3683
  const event_handler = $gVhhF$depictaiutilishared.catchify((what_happened, args) => {
3663
- if (what_happened == "popstate") $6e22b5314fb52f4c$var$history_state_change(signals, entries, args.state);
3684
+ // Intentionally always update our signals to the history state to allow external control of SDK state for doing things like https://linear.app/depictai/issue/X-1432/is-this-possible-with-the-depict-sdk
3685
+ $6e22b5314fb52f4c$var$history_state_change(signals, entries, what_happened === "popstate" ? args.state : history.state);
3664
3686
  });
3665
3687
  // createRenderEffect because we need the instant execution so the signals always contain values, even before solid's render phase
3666
3688
  $gVhhF$solidjs.createRenderEffect(() => {
@@ -4029,6 +4051,13 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
4029
4051
  }));
4030
4052
  }
4031
4053
  }
4054
+ function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
4055
+ const signal = $gVhhF$solidjs.createSignal(false);
4056
+ $gVhhF$solidjs.onCleanup($gVhhF$depictaiutilishared.javascript_media_query(media_query, ({
4057
+ matches: matches
4058
+ }) => signal[1](matches)).remove);
4059
+ return signal[0];
4060
+ }
4032
4061
  const $6b384adf40a5f4d7$var$get_available_range = (available_filters_, search_for_field) => {
4033
4062
  const maybe_meta = $gVhhF$solidjs.untrack(available_filters_)?.find(({
4034
4063
  op: op,
@@ -10893,7 +10922,7 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
10893
10922
  }, "failed to open page");
10894
10923
  #empty_page_bugfix() {
10895
10924
  // Called when a "page" is "opened" using PageReplacer
10896
- const on_maybe_popstate = what_happened => {
10925
+ const on_maybe_popstate = $gVhhF$depictaiutilishared.catchify(what_happened => {
10897
10926
  if (what_happened !== "popstate") return;
10898
10927
  const cleaned_current_url = $0a6acf31d1eae57c$var$clean_url(location.href);
10899
10928
  if (!$0a6acf31d1eae57c$export$3ccaa27d81dd8556.#visited_urls.has(cleaned_current_url)) {
@@ -10922,7 +10951,7 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
10922
10951
  $0a6acf31d1eae57c$export$3ccaa27d81dd8556.#reverting_permitted = false; // Disallow any reverting since we can't - it would flash a white page until the reload has finished.
10923
10952
  this.#unload(); // Call unload to "kill" the solid-js stuff quicker so that it stops updating - the user is expecting the next thing that happens to be a navigation to the actual page the URL says they're on.
10924
10953
  }
10925
- };
10954
+ });
10926
10955
 
10927
10956
  (0, $gVhhF$depictaiutilishared.instant_exec_on_suspect_history_change).add(on_maybe_popstate);
10928
10957
  this.#revert_fns.push(() => (0, $gVhhF$depictaiutilishared.instant_exec_on_suspect_history_change).delete(on_maybe_popstate)); // Don't run the bugfixer if there isn't a PageReplacer page open since I assume the bug only happens when going back from a PageReplace'd page
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.20";
10
+ export const version = "2.0.22";
11
11
  /**
12
12
  * Provider to wrap every listing (group of products) in
13
13
  * Used for example for deduplicating ResizeObservers for responsive images
@@ -342,10 +342,6 @@ export function SelectedFilters({
342
342
  selected_filters_: Signal<FilterWithData[]>;
343
343
  local_filter_cache_: Signal<SearchFilter[]>;
344
344
  }): HTMLDivElement;
345
- /**
346
- * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
347
- */
348
- export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
349
345
  /**
350
346
  * Base placeholder component used by ImagePlaceholder and TextPlaceholder
351
347
  */
@@ -614,6 +610,10 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
614
610
  failed?: true | undefined;
615
611
  }>;
616
612
  }
613
+ /**
614
+ * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
615
+ */
616
+ export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
617
617
  /**
618
618
  * Disables scrolling until the solidjs reactive scoped is disposed (onCleanup)
619
619
  * @returns A cleanup function to manually re-enable scrolling.
package/latest/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { add_to_version_info as $9HbP8$add_to_version_info, queueMacroTask as $9HbP8$queueMacroTask, catchify as $9HbP8$catchify, is_safari as $9HbP8$is_safari, observer as $9HbP8$observer, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, slider_fractional_factory as $9HbP8$slider_fractional_factory, dlog as $9HbP8$dlog, camelCasifyObject as $9HbP8$camelCasifyObject, make_random_classname as $9HbP8$make_random_classname, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, report as $9HbP8$report, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, javascript_media_query as $9HbP8$javascript_media_query, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, edit_current_page_meta_tags as $9HbP8$edit_current_page_meta_tags, use_href_accessor as $9HbP8$use_href_accessor, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, ListenableSet as $9HbP8$ListenableSet, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
1
+ import { add_to_version_info as $9HbP8$add_to_version_info, queueMacroTask as $9HbP8$queueMacroTask, catchify as $9HbP8$catchify, is_safari as $9HbP8$is_safari, observer as $9HbP8$observer, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, slider_fractional_factory as $9HbP8$slider_fractional_factory, dlog as $9HbP8$dlog, camelCasifyObject as $9HbP8$camelCasifyObject, make_random_classname as $9HbP8$make_random_classname, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, report as $9HbP8$report, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, edit_current_page_meta_tags as $9HbP8$edit_current_page_meta_tags, javascript_media_query as $9HbP8$javascript_media_query, use_href_accessor as $9HbP8$use_href_accessor, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, ListenableSet as $9HbP8$ListenableSet, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
2
2
  import { createComponent as $9HbP8$createComponent, template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, effect as $9HbP8$effect, style as $9HbP8$style, spread as $9HbP8$spread, mergeProps as $9HbP8$mergeProps, runHydrationEvents as $9HbP8$runHydrationEvents, insert as $9HbP8$insert, setAttribute as $9HbP8$setAttribute, isServer as $9HbP8$isServer, addEventListener as $9HbP8$addEventListener, className as $9HbP8$className, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, classList as $9HbP8$classList, getNextMarker as $9HbP8$getNextMarker, Dynamic as $9HbP8$Dynamic, use as $9HbP8$use } from "solid-js/web";
3
3
  import { createSignal as $9HbP8$createSignal, getOwner as $9HbP8$getOwner, createEffect as $9HbP8$createEffect, runWithOwner as $9HbP8$runWithOwner, onCleanup as $9HbP8$onCleanup, createMemo as $9HbP8$createMemo, createContext as $9HbP8$createContext, useContext as $9HbP8$useContext, createResource as $9HbP8$createResource, Suspense as $9HbP8$Suspense, Show as $9HbP8$Show, createRenderEffect as $9HbP8$createRenderEffect, createRoot as $9HbP8$createRoot, For as $9HbP8$For, createUniqueId as $9HbP8$createUniqueId, untrack as $9HbP8$untrack, createComputed as $9HbP8$createComputed, ErrorBoundary as $9HbP8$ErrorBoundary, Index as $9HbP8$Index, on as $9HbP8$on, batch as $9HbP8$batch, createReaction as $9HbP8$createReaction } from "solid-js";
4
4
 
5
5
  /*! Depict.ai search and product listing SDK */
6
6
  import { register_es_version } from "../multi_import_deduplicator.mjs";
7
7
  register_es_version("ui", "latest");
8
- const $ec291e0010116877$export$83d89fbfd8236492 = "2.0.20";
8
+ const $ec291e0010116877$export$83d89fbfd8236492 = "2.0.22";
9
9
  const $011607bdf658f807$var$ListingContext = /*@__PURE__*/$9HbP8$createContext();
10
10
  function $011607bdf658f807$export$e68cff63f76bd15b(props) {
11
11
  const our_object = {};
@@ -1189,6 +1189,14 @@ function $19976a74d273070d$export$3b621d86b1566b2(props = {}) {
1189
1189
  return _el$;
1190
1190
  })();
1191
1191
  }
1192
+
1193
+ /**
1194
+ * Lower cases a string if possible. Mostly used to make the filter url values case-insensitive.
1195
+ */
1196
+ function $91aa8ee9f431800d$export$325f75597868c4f0(stuff) {
1197
+ if (typeof stuff !== "string") return stuff;
1198
+ return stuff.toLowerCase();
1199
+ }
1192
1200
  const $1adfe60f3a14a1d7$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<button class="clear-all-filters minor"></button>`, 2),
1193
1201
  $1adfe60f3a14a1d7$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<div class="inner"><span class="title"><!#><!/>: </span><!#><!/></div>`, 8),
1194
1202
  $1adfe60f3a14a1d7$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<button class="clear-filter major"><!#><!/><span><!#><!/><!#><!/><!#><!/> – <!#><!/><!#><!/><!#><!/></span></button>`, 18),
@@ -1274,7 +1282,7 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
1274
1282
  let parent_ = {};
1275
1283
  let created_an_object = false;
1276
1284
  for (let j = 0; j < value.length; j++) {
1277
- const this_categories_name = value[j];
1285
+ const this_categories_name = $91aa8ee9f431800d$export$325f75597868c4f0(value[j]);
1278
1286
  const obj = pointer[this_categories_name] ||= (() => {
1279
1287
  const value_as_string = value.map(v => typeof v === "number" ? v + "" : v); // don't think backend will ever send numbers but technically it's allowed;
1280
1288
  const created_obj = {
@@ -1378,7 +1386,7 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
1378
1386
  const index_of_us_in_meta = $9HbP8$createMemo(() => {
1379
1387
  const sel_d = selected_data();
1380
1388
  return meta()?.values?.findIndex(value => {
1381
- return value === sel_d || Array.isArray(value) && Array.isArray(sel_d) && value.length === sel_d.length && value.every((item, index) => sel_d[index] === item);
1389
+ return $91aa8ee9f431800d$export$325f75597868c4f0(value) === $91aa8ee9f431800d$export$325f75597868c4f0(sel_d) || Array.isArray(value) && Array.isArray(sel_d) && value.length === sel_d.length && value.every((item, index) => $91aa8ee9f431800d$export$325f75597868c4f0(sel_d[index]) === $91aa8ee9f431800d$export$325f75597868c4f0(item));
1382
1390
  });
1383
1391
  });
1384
1392
  const name = $9HbP8$createMemo(() => {
@@ -1392,7 +1400,7 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
1392
1400
  let we_in_structure;
1393
1401
  let pointer = structure;
1394
1402
  for (const step of selected_data()) {
1395
- we_in_structure = pointer?.[step];
1403
+ we_in_structure = pointer?.[$91aa8ee9f431800d$export$325f75597868c4f0(step)];
1396
1404
  pointer = we_in_structure?.children_;
1397
1405
  }
1398
1406
  return we_in_structure;
@@ -1403,7 +1411,7 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
1403
1411
  const siblings = parent?.children_;
1404
1412
  if (siblings) return [parent, ...Object.values(siblings)].every(({
1405
1413
  value_: value_
1406
- }) => iterable_selected_filter_data()?.some(v => Array.isArray(v) && v.length === value_.length && value_.every((val, index) => v[index] === val)));
1414
+ }) => iterable_selected_filter_data()?.some(v => Array.isArray(v) && v.length === value_.length && value_.every((val, index) => $91aa8ee9f431800d$export$325f75597868c4f0(v[index]) === $91aa8ee9f431800d$export$325f75597868c4f0(val))));
1407
1415
  return false;
1408
1416
  });
1409
1417
  return $9HbP8$createComponent((0, $9HbP8$Show), {
@@ -1425,7 +1433,7 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
1425
1433
  cloned_selected_filters.splice(index_in_selected_filters, 1);
1426
1434
  const data = filter().data;
1427
1435
  const cloned_data = Array.isArray(data) ? [...data] : [data];
1428
- const index_of_item = cloned_data.findIndex(item => item === to_remove);
1436
+ const index_of_item = cloned_data.findIndex(item => $91aa8ee9f431800d$export$325f75597868c4f0(item) === $91aa8ee9f431800d$export$325f75597868c4f0(to_remove));
1429
1437
  if (index_of_item >= 0) cloned_data.splice(index_of_item, 1);
1430
1438
  const in_structure = us_in_structure();
1431
1439
  if (in_structure) {
@@ -1436,7 +1444,7 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
1436
1444
  const {
1437
1445
  value_: value_
1438
1446
  } = kid;
1439
- const index_to_remove = cloned_data.findIndex(item => Array.isArray(item) && item.length === value_.length && value_.every((val, index) => item[index] === val));
1447
+ const index_to_remove = cloned_data.findIndex(item => Array.isArray(item) && item.length === value_.length && value_.every((val, index) => $91aa8ee9f431800d$export$325f75597868c4f0(item[index]) === $91aa8ee9f431800d$export$325f75597868c4f0(val)));
1440
1448
  if (index_to_remove >= 0) cloned_data.splice(index_to_remove, 1);
1441
1449
  recursive_kids.push(...Object.values(kid.children_));
1442
1450
  }
@@ -1615,6 +1623,11 @@ function $a4601e6bea3ed1e6$export$dd948f91abc3a1c4({
1615
1623
  });
1616
1624
  const render_checkbox = checkbox => {
1617
1625
  // Checkbox always calls the getters in props, so we don't wrap these values into memos
1626
+ const is_checked = $9HbP8$createMemo(() => {
1627
+ const data = existing_filter()?.data;
1628
+ const value = $91aa8ee9f431800d$export$325f75597868c4f0(checkbox().value_);
1629
+ return !!data?.some(item => $91aa8ee9f431800d$export$325f75597868c4f0(item) === value);
1630
+ });
1618
1631
  return $9HbP8$createComponent((0, $49b79728e7d9e2a1$export$48513f6b9f8ce62d), {
1619
1632
  get value_() {
1620
1633
  return checkbox().value_;
@@ -1626,7 +1639,7 @@ function $a4601e6bea3ed1e6$export$dd948f91abc3a1c4({
1626
1639
  return checkbox().count_;
1627
1640
  },
1628
1641
  get checked_() {
1629
- return existing_filter()?.data?.includes(checkbox().value_);
1642
+ return is_checked();
1630
1643
  }
1631
1644
  });
1632
1645
  };
@@ -1778,7 +1791,7 @@ function $eb8d9bf3b5700c26$export$430444115f70a734({
1778
1791
  $9HbP8$effect(() => _el$4.checked = $9HbP8$createMemo(() => {
1779
1792
  const v = value();
1780
1793
  const data = existing_filter()?.data;
1781
- if (data === v) return true;
1794
+ if ($91aa8ee9f431800d$export$325f75597868c4f0(data) === $91aa8ee9f431800d$export$325f75597868c4f0(v)) return true;
1782
1795
  return Array.isArray(data) && data.every((item, index) => item === v[index]);
1783
1796
  })());
1784
1797
  return _el$2;
@@ -2500,7 +2513,7 @@ function $1c8cac76cb67e9af$var$create_updating_signal({
2500
2513
  const on_structure_complete_ = () => {
2501
2514
  // wait for the children to have populated and us to have received the correct value_ and name_ values
2502
2515
  let updating_blocked = false;
2503
- 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));
2516
+ const index_of_us_in_selected_filter = existing_filter_?.data?.findIndex?.(el => el.length === self_.value_.length && el.every((sub_el, index) => $91aa8ee9f431800d$export$325f75597868c4f0(self_.value_[index]) === $91aa8ee9f431800d$export$325f75597868c4f0(sub_el)));
2504
2517
  signal_.push(...$9HbP8$createSignal(index_of_us_in_selected_filter >= 0));
2505
2518
  const [read_checked, write_checked] = signal_;
2506
2519
  const child_objects = Object.values(self_.children_);
@@ -2671,7 +2684,11 @@ const $93716a9ad0dea854$export$414f6a19d38e655c = ({
2671
2684
  return buttons();
2672
2685
  },
2673
2686
  children: value => {
2674
- const is_selected = $9HbP8$createMemo(() => existing_filter()?.data?.includes(value().value_));
2687
+ const is_selected = $9HbP8$createMemo(() => {
2688
+ const data = existing_filter()?.data;
2689
+ const current_value = $91aa8ee9f431800d$export$325f75597868c4f0(value().value_);
2690
+ return !!data?.some(item => $91aa8ee9f431800d$export$325f75597868c4f0(item) === current_value);
2691
+ });
2675
2692
  const MakeButton = attributes => (() => {
2676
2693
  const _el$2 = $9HbP8$getNextElement($93716a9ad0dea854$var$_tmpl$3),
2677
2694
  _el$5 = _el$2.firstChild,
@@ -2706,7 +2723,10 @@ const $93716a9ad0dea854$export$414f6a19d38e655c = ({
2706
2723
  ...base_object,
2707
2724
  data: new_data
2708
2725
  };
2709
- if (!is_selected()) new_filter_object.data.push(value().value_);else new_filter_object.data = new_filter_object.data.filter(v => v !== value().value_);
2726
+ if (!is_selected()) new_filter_object.data.push(value().value_);else {
2727
+ const current_value_lower = $91aa8ee9f431800d$export$325f75597868c4f0(value().value_);
2728
+ new_filter_object.data = new_filter_object.data.filter(v => $91aa8ee9f431800d$export$325f75597868c4f0(v) !== current_value_lower);
2729
+ }
2710
2730
  const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
2711
2731
  set_selected_filters(selected_filters);
2712
2732
  });
@@ -2807,13 +2827,6 @@ function $93716a9ad0dea854$var$adjust_sizes(container_width, sizes, set_cols_at_
2807
2827
  overrides: column_to_row_result
2808
2828
  }]]);
2809
2829
  }
2810
- function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
2811
- const signal = $9HbP8$createSignal(false);
2812
- $9HbP8$onCleanup($9HbP8$javascript_media_query(media_query, ({
2813
- matches: matches
2814
- }) => signal[1](matches)).remove);
2815
- return signal[0];
2816
- }
2817
2830
  const $e731d52d97444b7c$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<form class="checkbox-color"><!#><!/><!#><!/></form>`, 6);
2818
2831
  const $e731d52d97444b7c$var$max_visible_without_collapsing = 30;
2819
2832
  const $e731d52d97444b7c$var$show_non_collapsible_when_collapsed = 8;
@@ -2823,7 +2836,6 @@ function $e731d52d97444b7c$export$82ed4b28ecb67608({
2823
2836
  i18n_: i18n_,
2824
2837
  view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_]
2825
2838
  }) {
2826
- const supports_hover = $dc9262ef6f786812$export$d9f36cf74e24d595("not all and (hover: none)");
2827
2839
  // same as in CheckboxFilter, maybe we should make this DRY at some point
2828
2840
  const existing_filter = $9HbP8$createMemo(() => {
2829
2841
  const {
@@ -2851,6 +2863,11 @@ function $e731d52d97444b7c$export$82ed4b28ecb67608({
2851
2863
  const hex_color = $9HbP8$createMemo(() => checkbox().value_.split(";")?.[1] || "");
2852
2864
  const rgb_color = $9HbP8$createMemo(() => $9HbP8$hex_to_rgb(hex_color()));
2853
2865
  const black_contrast_better = $9HbP8$createMemo(() => rgb_color() ? $e731d52d97444b7c$var$does_black_contrast_better(rgb_color()) : false);
2866
+ const is_checked = $9HbP8$createMemo(() => {
2867
+ const data = existing_filter()?.data;
2868
+ const value = $91aa8ee9f431800d$export$325f75597868c4f0(checkbox().value_);
2869
+ return !!data?.some(item => $91aa8ee9f431800d$export$325f75597868c4f0(item) === value);
2870
+ });
2854
2871
  const input_row = $9HbP8$createComponent((0, $49b79728e7d9e2a1$export$48513f6b9f8ce62d), {
2855
2872
  get value_() {
2856
2873
  return checkbox().value_;
@@ -2862,7 +2879,7 @@ function $e731d52d97444b7c$export$82ed4b28ecb67608({
2862
2879
  return checkbox().count_;
2863
2880
  },
2864
2881
  get checked_() {
2865
- return existing_filter()?.data?.includes(checkbox().value_);
2882
+ return is_checked();
2866
2883
  },
2867
2884
  custom_indicator_ref: span => {
2868
2885
  const {
@@ -3045,7 +3062,7 @@ function $a7b58cb3bcffd156$export$53c59af873b303c9({
3045
3062
  break try_specific;
3046
3063
  }
3047
3064
  const needle = data_is_array ? data[0] : data;
3048
- const index_in_meta = meta.values.findIndex(value => needle === value || Array.isArray(needle) && Array.isArray(value) && needle.length === value.length && value.every((item, index) => needle[index] === item));
3065
+ const index_in_meta = meta.values.findIndex(value => $91aa8ee9f431800d$export$325f75597868c4f0(needle) === $91aa8ee9f431800d$export$325f75597868c4f0(value) || Array.isArray(needle) && Array.isArray(value) && needle.length === value.length && value.every((item, index) => $91aa8ee9f431800d$export$325f75597868c4f0(needle[index]) === $91aa8ee9f431800d$export$325f75597868c4f0(item)));
3049
3066
  return meta.names?.[index_in_meta] || meta.values?.[index_in_meta];
3050
3067
  }
3051
3068
  }
@@ -3232,7 +3249,11 @@ function $fab07f52c9861732$var$ActualFilterBody(props) {
3232
3249
  return $9HbP8$createComponent((0, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d), {
3233
3250
  is_open_: is_open,
3234
3251
  get details_() {
3235
- return $9HbP8$getNextElement($fab07f52c9861732$var$_tmpl$5);
3252
+ return (() => {
3253
+ const _el$15 = $9HbP8$getNextElement($fab07f52c9861732$var$_tmpl$5);
3254
+ $9HbP8$setAttribute(_el$15, "data-group-title", section_);
3255
+ return _el$15;
3256
+ })();
3236
3257
  },
3237
3258
  get summary_() {
3238
3259
  return (() => {
@@ -3599,7 +3620,8 @@ function $ca6f574bd8772184$export$e183a13865960371(params_to_default_value, rout
3599
3620
  const signals = {};
3600
3621
  const entries = Object.entries(params_to_default_value);
3601
3622
  const event_handler = $9HbP8$catchify((what_happened, args) => {
3602
- if (what_happened == "popstate") $ca6f574bd8772184$var$history_state_change(signals, entries, args.state);
3623
+ // Intentionally always update our signals to the history state to allow external control of SDK state for doing things like https://linear.app/depictai/issue/X-1432/is-this-possible-with-the-depict-sdk
3624
+ $ca6f574bd8772184$var$history_state_change(signals, entries, what_happened === "popstate" ? args.state : history.state);
3603
3625
  });
3604
3626
  // createRenderEffect because we need the instant execution so the signals always contain values, even before solid's render phase
3605
3627
  $9HbP8$createRenderEffect(() => {
@@ -3968,6 +3990,13 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
3968
3990
  }));
3969
3991
  }
3970
3992
  }
3993
+ function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
3994
+ const signal = $9HbP8$createSignal(false);
3995
+ $9HbP8$onCleanup($9HbP8$javascript_media_query(media_query, ({
3996
+ matches: matches
3997
+ }) => signal[1](matches)).remove);
3998
+ return signal[0];
3999
+ }
3971
4000
  const $fc5a12f3a857ca30$var$get_available_range = (available_filters_, search_for_field) => {
3972
4001
  const maybe_meta = $9HbP8$untrack(available_filters_)?.find(({
3973
4002
  op: op,
@@ -10832,7 +10861,7 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
10832
10861
  }, "failed to open page");
10833
10862
  #empty_page_bugfix() {
10834
10863
  // Called when a "page" is "opened" using PageReplacer
10835
- const on_maybe_popstate = what_happened => {
10864
+ const on_maybe_popstate = $9HbP8$catchify(what_happened => {
10836
10865
  if (what_happened !== "popstate") return;
10837
10866
  const cleaned_current_url = $753e9b2889a47c89$var$clean_url(location.href);
10838
10867
  if (!$753e9b2889a47c89$export$3ccaa27d81dd8556.#visited_urls.has(cleaned_current_url)) {
@@ -10861,7 +10890,7 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
10861
10890
  $753e9b2889a47c89$export$3ccaa27d81dd8556.#reverting_permitted = false; // Disallow any reverting since we can't - it would flash a white page until the reload has finished.
10862
10891
  this.#unload(); // Call unload to "kill" the solid-js stuff quicker so that it stops updating - the user is expecting the next thing that happens to be a navigation to the actual page the URL says they're on.
10863
10892
  }
10864
- };
10893
+ });
10865
10894
 
10866
10895
  (0, $9HbP8$instant_exec_on_suspect_history_change).add(on_maybe_popstate);
10867
10896
  this.#revert_fns.push(() => (0, $9HbP8$instant_exec_on_suspect_history_change).delete(on_maybe_popstate)); // Don't run the bugfixer if there isn't a PageReplacer page open since I assume the bug only happens when going back from a PageReplace'd page
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "2.0.20",
3
+ "version": "2.0.22",
4
4
  "description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
5
5
  "packageManager": "yarn@3.2.2",
6
6
  "sass": "styles.scss",
@@ -238,7 +238,7 @@
238
238
  "@babel/runtime-corejs3": "^7.22.6",
239
239
  "@depict-ai/plp-styling": "^1.2.5",
240
240
  "@depict-ai/types": "^1.0.39",
241
- "@depict-ai/utilishared": "^1.0.45",
241
+ "@depict-ai/utilishared": "^1.0.46",
242
242
  "solid-js": "^1.7.3"
243
243
  },
244
244
  "type": "module",