@depict-ai/ui 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ES10/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { add_to_version_info as $8tj43$add_to_version_info, slider_fractional_factory as $8tj43$slider_fractional_factory, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, catchify as $8tj43$catchify, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, slider_fading_factory as $8tj43$slider_fading_factory, observer as $8tj43$observer, is_safari as $8tj43$is_safari, useExpandingContainer as $8tj43$useExpandingContainer, standard_price_format as $8tj43$standard_price_format, dlog as $8tj43$dlog, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, javascript_media_query as $8tj43$javascript_media_query, fetch_recs as $8tj43$fetch_recs, snakeCasifyObject as $8tj43$snakeCasifyObject, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, base_url as $8tj43$base_url, get_depict_id as $8tj43$get_depict_id, get_user_id as $8tj43$get_user_id, get_session_id as $8tj43$get_session_id, make_url_with_query_params as $8tj43$make_url_with_query_params, fetch_retry as $8tj43$fetch_retry, add_version_query_params as $8tj43$add_version_query_params, dwarn as $8tj43$dwarn, sort_obj as $8tj43$sort_obj, edit_current_page_meta_tags as $8tj43$edit_current_page_meta_tags, use_href_accessor as $8tj43$use_href_accessor, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, queueMacroTask as $8tj43$queueMacroTask, is_debug as $8tj43$is_debug, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, deparallelize_no_drop as $8tj43$deparallelize_no_drop, ListenableSet as $8tj43$ListenableSet, insert_surfaces as $8tj43$insert_surfaces } from "@depict-ai/utilishared/ES10";
1
+ import { add_to_version_info as $8tj43$add_to_version_info, catchify as $8tj43$catchify, slider_fractional_factory as $8tj43$slider_fractional_factory, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, slider_fading_factory as $8tj43$slider_fading_factory, observer as $8tj43$observer, is_safari as $8tj43$is_safari, useExpandingContainer as $8tj43$useExpandingContainer, standard_price_format as $8tj43$standard_price_format, dlog as $8tj43$dlog, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, javascript_media_query as $8tj43$javascript_media_query, fetch_recs as $8tj43$fetch_recs, snakeCasifyObject as $8tj43$snakeCasifyObject, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, base_url as $8tj43$base_url, get_depict_id as $8tj43$get_depict_id, get_user_id as $8tj43$get_user_id, get_session_id as $8tj43$get_session_id, make_url_with_query_params as $8tj43$make_url_with_query_params, fetch_retry as $8tj43$fetch_retry, add_version_query_params as $8tj43$add_version_query_params, dwarn as $8tj43$dwarn, sort_obj as $8tj43$sort_obj, edit_current_page_meta_tags as $8tj43$edit_current_page_meta_tags, use_href_accessor as $8tj43$use_href_accessor, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, queueMacroTask as $8tj43$queueMacroTask, is_debug as $8tj43$is_debug, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, deparallelize_no_drop as $8tj43$deparallelize_no_drop, ListenableSet as $8tj43$ListenableSet, insert_surfaces as $8tj43$insert_surfaces } from "@depict-ai/utilishared/ES10";
2
+ import { createSignal as $8tj43$createSignal, onCleanup as $8tj43$onCleanup, createMemo as $8tj43$createMemo, createResource as $8tj43$createResource, Suspense as $8tj43$Suspense, Show as $8tj43$Show, createRenderEffect as $8tj43$createRenderEffect, createRoot as $8tj43$createRoot, For as $8tj43$For, getOwner as $8tj43$getOwner, runWithOwner as $8tj43$runWithOwner, createEffect as $8tj43$createEffect, untrack as $8tj43$untrack, createUniqueId as $8tj43$createUniqueId, createComputed as $8tj43$createComputed, ErrorBoundary as $8tj43$ErrorBoundary, Index as $8tj43$Index, on as $8tj43$on, batch as $8tj43$batch, createReaction as $8tj43$createReaction } from "solid-js";
2
3
  import { template as $8tj43$template, getNextElement as $8tj43$getNextElement, insert as $8tj43$insert, createComponent as $8tj43$createComponent, mergeProps as $8tj43$mergeProps, isServer as $8tj43$isServer, spread as $8tj43$spread, runHydrationEvents as $8tj43$runHydrationEvents, addEventListener as $8tj43$addEventListener, className as $8tj43$className, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, effect as $8tj43$effect, classList as $8tj43$classList, setAttribute as $8tj43$setAttribute, getNextMarker as $8tj43$getNextMarker, style as $8tj43$style, Dynamic as $8tj43$Dynamic, use as $8tj43$use } from "solid-js/web";
3
- import { createMemo as $8tj43$createMemo, createResource as $8tj43$createResource, Suspense as $8tj43$Suspense, Show as $8tj43$Show, createSignal as $8tj43$createSignal, createRenderEffect as $8tj43$createRenderEffect, createRoot as $8tj43$createRoot, onCleanup as $8tj43$onCleanup, For as $8tj43$For, getOwner as $8tj43$getOwner, runWithOwner as $8tj43$runWithOwner, createEffect as $8tj43$createEffect, untrack as $8tj43$untrack, createUniqueId as $8tj43$createUniqueId, createComputed as $8tj43$createComputed, ErrorBoundary as $8tj43$ErrorBoundary, Index as $8tj43$Index, on as $8tj43$on, batch as $8tj43$batch, createReaction as $8tj43$createReaction } from "solid-js";
4
4
  import $8tj43$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
5
5
  import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
6
6
  import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
@@ -8,7 +8,23 @@ import $8tj43$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.1";
11
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0.3";
12
+
13
+ /** @jsxImportSource solid-js */
14
+
15
+ function $0dc044cffe1e825b$export$9f191182275e9ef(what_to_watch) {
16
+ const [size, setSize] = $8tj43$createSignal();
17
+ const resizeObserver = new ResizeObserver($8tj43$catchify(records => {
18
+ for (let j = 0; j < records.length; j++) {
19
+ var _records$j$borderBoxS, _records$j$borderBoxS2, _records$j$borderBoxS3;
20
+ const width = (_records$j$borderBoxS = (_records$j$borderBoxS2 = records[j].borderBoxSize) === null || _records$j$borderBoxS2 === void 0 ? void 0 : (_records$j$borderBoxS3 = _records$j$borderBoxS2[0]) === null || _records$j$borderBoxS3 === void 0 ? void 0 : _records$j$borderBoxS3.inlineSize) !== null && _records$j$borderBoxS !== void 0 ? _records$j$borderBoxS : what_to_watch.getBoundingClientRect().width;
21
+ setSize(width);
22
+ }
23
+ }));
24
+ resizeObserver.observe(what_to_watch);
25
+ $8tj43$onCleanup(() => resizeObserver.disconnect());
26
+ return size;
27
+ }
12
28
  const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
13
29
  const cols_at_size = [];
14
30
  for (let i = 0; i < sorted_cols_at_size.length; i++) {
@@ -1437,9 +1453,9 @@ function $4711a82d08d2021b$export$fecbb157621501bd(_ref) {
1437
1453
  return outmost_element;
1438
1454
  }
1439
1455
  $8tj43$delegateEvents(["click"]);
1440
- const $6b73914551534ea8$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class="count"></span>`, 2),
1441
- $6b73914551534ea8$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<label class="input-row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text line-clamp"></span></div><!#><!/></label>`, 11);
1442
- const $6b73914551534ea8$export$48513f6b9f8ce62d = props => {
1456
+ const $19e828709c7723a0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class="count"></span>`, 2),
1457
+ $19e828709c7723a0$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<label class="input-row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text line-clamp"></span></div><!#><!/></label>`, 11);
1458
+ const $19e828709c7723a0$export$48513f6b9f8ce62d = props => {
1443
1459
  // It seems like there's no diffing without memos here (since we often just have computations in the getters above that update to the same result often because their dependencies change with unrelated changes often), so put memos here to avoid unneeded DOM changes
1444
1460
  const count = $8tj43$createMemo(() => props.count_);
1445
1461
  const label = $8tj43$createMemo(() => props.label_);
@@ -1448,7 +1464,7 @@ const $6b73914551534ea8$export$48513f6b9f8ce62d = props => {
1448
1464
  const is_count_zero = $8tj43$createMemo(() => props.is_count_zero_ || count() === 0);
1449
1465
  const id = $8tj43$make_random_classname();
1450
1466
  return (/* We can't use actual margin because ExpandingContainer gets messed up */(() => {
1451
- const _el$ = $8tj43$getNextElement($6b73914551534ea8$var$_tmpl$2),
1467
+ const _el$ = $8tj43$getNextElement($19e828709c7723a0$var$_tmpl$2),
1452
1468
  _el$2 = _el$.firstChild,
1453
1469
  _el$3 = _el$2.firstChild,
1454
1470
  _el$4 = _el$3.nextSibling,
@@ -1479,7 +1495,7 @@ const $6b73914551534ea8$export$48513f6b9f8ce62d = props => {
1479
1495
  return count() != undefined;
1480
1496
  },
1481
1497
  get children() {
1482
- const _el$6 = $8tj43$getNextElement($6b73914551534ea8$var$_tmpl$);
1498
+ const _el$6 = $8tj43$getNextElement($19e828709c7723a0$var$_tmpl$);
1483
1499
  $8tj43$insert(_el$6, count);
1484
1500
  return _el$6;
1485
1501
  }
@@ -1575,7 +1591,7 @@ function $133484ef10e4e954$export$dd948f91abc3a1c4(_ref) {
1575
1591
  });
1576
1592
  const render_checkbox = checkbox => {
1577
1593
  // Checkbox always calls the getters in props, so we don't wrap these values into memos
1578
- return $8tj43$createComponent((0, $6b73914551534ea8$export$48513f6b9f8ce62d), {
1594
+ return $8tj43$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
1579
1595
  get value_() {
1580
1596
  return checkbox().value_;
1581
1597
  },
@@ -2319,7 +2335,7 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
2319
2335
  [_el$8, _co$3] = $8tj43$getNextMarker(_el$7.nextSibling),
2320
2336
  _el$9 = _el$8.nextSibling,
2321
2337
  [_el$10, _co$4] = $8tj43$getNextMarker(_el$9.nextSibling);
2322
- $8tj43$insert(_el$6, $8tj43$createComponent((0, $6b73914551534ea8$export$48513f6b9f8ce62d), {
2338
+ $8tj43$insert(_el$6, $8tj43$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
2323
2339
  get value_() {
2324
2340
  var _value2;
2325
2341
  return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
@@ -2609,9 +2625,11 @@ function $0ae614c5c7babb43$var$expand_until_choice(data_structure) {
2609
2625
  }
2610
2626
  });
2611
2627
  }
2612
- const $830ea8efda59884e$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="checkbox-grid"></div>`, 2),
2628
+ const $830ea8efda59884e$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="checkbox-grid" style="position:absolute;z-index:-1;pointer-events:none;opacity:0"></div>`, 2),
2613
2629
  $830ea8efda59884e$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<span class="count-wrapper"><span class="count"></span></span>`, 4),
2614
- $830ea8efda59884e$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<button class="major-minor-transition"><!#><!/><!#><!/></button>`, 6);
2630
+ $830ea8efda59884e$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<button><!#><!/><!#><!/></button>`, 6);
2631
+ const $830ea8efda59884e$var$gap_px = 5;
2632
+ const $830ea8efda59884e$var$max_columns = 3;
2615
2633
  const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
2616
2634
  let {
2617
2635
  filter_: filter_,
@@ -2641,77 +2659,187 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
2641
2659
  };
2642
2660
  });
2643
2661
  });
2644
- return (() => {
2662
+ const [sizes_set, set_sizes_set] = $8tj43$createSignal(new Set(), {
2663
+ equals: false
2664
+ });
2665
+ const [cols_at_size, set_cols_at_size] = $8tj43$createSignal([[1, "0px", ""]]);
2666
+ const [container, set_container] = $8tj43$createSignal();
2667
+ const container_width_accessor = $8tj43$createMemo(() => {
2668
+ const element = container();
2669
+ if (!element) return;
2670
+ return $0dc044cffe1e825b$export$9f191182275e9ef(element);
2671
+ });
2672
+ const [shadow_children, set_shadow_children] = $8tj43$createSignal(new Set(), {
2673
+ equals: false
2674
+ });
2675
+ const shadow_grid = (() => {
2645
2676
  const _el$ = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$);
2646
- $8tj43$insert(_el$, $8tj43$createComponent((0, $8tj43$Index), {
2647
- get each() {
2648
- return buttons();
2649
- },
2650
- children: value => {
2651
- const is_selected = $8tj43$createMemo(() => {
2652
- var _existing_filter, _existing_filter$data;
2653
- return (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : (_existing_filter$data = _existing_filter.data) === null || _existing_filter$data === void 0 ? void 0 : _existing_filter$data.includes(value().value_);
2654
- });
2655
- return (() => {
2656
- const _el$2 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$3),
2657
- _el$5 = _el$2.firstChild,
2658
- [_el$6, _co$] = $8tj43$getNextMarker(_el$5.nextSibling),
2659
- _el$7 = _el$6.nextSibling,
2660
- [_el$8, _co$2] = $8tj43$getNextMarker(_el$7.nextSibling);
2661
- $8tj43$addEventListener(_el$2, "click", $8tj43$catchify(() => {
2662
- const set_filter = existing_filter();
2663
- const {
2664
- field: field,
2665
- op: op
2666
- } = filter_();
2667
- const base_object = set_filter ? set_filter : {
2668
- op: op,
2669
- field: field
2670
- };
2671
- const old_data = base_object.data;
2672
- const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
2673
- const new_filter_object = {
2674
- ...base_object,
2675
- data: new_data
2676
- };
2677
- if (!is_selected()) new_filter_object.data.push(value().value_);else new_filter_object.data = new_filter_object.data.filter(v => v !== value().value_);
2678
- const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
2679
- set_selected_filters(selected_filters);
2680
- }), true);
2681
- $8tj43$insert(_el$2, () => value().value_, _el$6, _co$);
2682
- $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
2683
- get when() {
2684
- return value().count_ != undefined;
2685
- },
2686
- get children() {
2687
- const _el$3 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$2),
2688
- _el$4 = _el$3.firstChild;
2689
- $8tj43$insert(_el$4, () => value().count_);
2690
- return _el$3;
2691
- }
2692
- }), _el$8, _co$2);
2693
- $8tj43$effect(_p$ => {
2694
- const _v$ = value().count_ === 0 && !is_selected(),
2695
- _v$2 = !is_selected(),
2696
- _v$3 = !!is_selected();
2697
- _v$ !== _p$._v$ && (_el$2.disabled = _p$._v$ = _v$);
2698
- _v$2 !== _p$._v$2 && _el$2.classList.toggle("minor", _p$._v$2 = _v$2);
2699
- _v$3 !== _p$._v$3 && _el$2.classList.toggle("major", _p$._v$3 = _v$3);
2700
- return _p$;
2701
- }, {
2702
- _v$: undefined,
2703
- _v$2: undefined,
2704
- _v$3: undefined
2705
- });
2706
- $8tj43$runHydrationEvents();
2707
- return _el$2;
2708
- })();
2709
- }
2710
- }));
2677
+ $8tj43$insert(_el$, () => [...shadow_children()]);
2711
2678
  return _el$;
2712
- })();
2679
+ })(); // for getting the smallest possible sizes of all the items
2680
+ $8tj43$createEffect(() => {
2681
+ var _container_width_acce;
2682
+ const container_width = (_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce();
2683
+ if (container_width == undefined) return;
2684
+ $830ea8efda59884e$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
2685
+ });
2686
+ return [shadow_grid, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
2687
+ get cols_at_size() {
2688
+ return cols_at_size();
2689
+ },
2690
+ grid_spacing: $830ea8efda59884e$var$gap_px + "px",
2691
+ rows: "all",
2692
+ layout: "grid",
2693
+ element_attributes: {
2694
+ class: "checkbox-grid",
2695
+ ref: el => set_container(el)
2696
+ },
2697
+ get children() {
2698
+ return $8tj43$createComponent((0, $8tj43$Index), {
2699
+ get each() {
2700
+ return buttons();
2701
+ },
2702
+ children: value => {
2703
+ const is_selected = $8tj43$createMemo(() => {
2704
+ var _existing_filter, _existing_filter$data;
2705
+ return (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : (_existing_filter$data = _existing_filter.data) === null || _existing_filter$data === void 0 ? void 0 : _existing_filter$data.includes(value().value_);
2706
+ });
2707
+ const MakeButton = attributes => (() => {
2708
+ const _el$2 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$3),
2709
+ _el$5 = _el$2.firstChild,
2710
+ [_el$6, _co$] = $8tj43$getNextMarker(_el$5.nextSibling),
2711
+ _el$7 = _el$6.nextSibling,
2712
+ [_el$8, _co$2] = $8tj43$getNextMarker(_el$7.nextSibling);
2713
+ $8tj43$spread(_el$2, $8tj43$mergeProps(attributes, {
2714
+ get disabled() {
2715
+ return $8tj43$memo(() => value().count_ === 0)() && !is_selected();
2716
+ },
2717
+ get classList() {
2718
+ return {
2719
+ minor: !is_selected(),
2720
+ major: is_selected(),
2721
+ "major-minor-transition": true
2722
+ };
2723
+ },
2724
+ get onClick() {
2725
+ return $8tj43$catchify(() => {
2726
+ const set_filter = existing_filter();
2727
+ const {
2728
+ field: field,
2729
+ op: op
2730
+ } = filter_();
2731
+ const base_object = set_filter ? set_filter : {
2732
+ op: op,
2733
+ field: field
2734
+ };
2735
+ const old_data = base_object.data;
2736
+ const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
2737
+ const new_filter_object = {
2738
+ ...base_object,
2739
+ data: new_data
2740
+ };
2741
+ if (!is_selected()) new_filter_object.data.push(value().value_);else new_filter_object.data = new_filter_object.data.filter(v => v !== value().value_);
2742
+ const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
2743
+ set_selected_filters(selected_filters);
2744
+ });
2745
+ }
2746
+ }), false, true);
2747
+ $8tj43$insert(_el$2, () => value().value_, _el$6, _co$);
2748
+ $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
2749
+ get when() {
2750
+ return value().count_ != undefined;
2751
+ },
2752
+ get children() {
2753
+ const _el$3 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$2),
2754
+ _el$4 = _el$3.firstChild;
2755
+ $8tj43$insert(_el$4, () => value().count_);
2756
+ return _el$3;
2757
+ }
2758
+ }), _el$8, _co$2);
2759
+ $8tj43$runHydrationEvents();
2760
+ return _el$2;
2761
+ })();
2762
+ const invisible_size_button = $8tj43$createComponent(MakeButton, {});
2763
+ const smallest_possible_size = $0dc044cffe1e825b$export$9f191182275e9ef(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
2764
+ const sizes_value = $8tj43$untrack(sizes_set);
2765
+ const shadow_children_value = $8tj43$untrack(shadow_children);
2766
+ sizes_value.add(smallest_possible_size);
2767
+ set_sizes_set(sizes_value);
2768
+ shadow_children_value.add(invisible_size_button);
2769
+ set_shadow_children(shadow_children_value);
2770
+ $8tj43$onCleanup(() => {
2771
+ const sizes_value = $8tj43$untrack(sizes_set);
2772
+ const shadow_children_value = $8tj43$untrack(shadow_children);
2773
+ sizes_value.delete(smallest_possible_size);
2774
+ set_sizes_set(sizes_value);
2775
+ shadow_children_value.delete(invisible_size_button);
2776
+ set_shadow_children(shadow_children_value);
2777
+ });
2778
+ // The actual button that will be visible
2779
+ return $8tj43$createComponent(MakeButton, {});
2780
+ }
2781
+ });
2782
+ }
2783
+ })];
2713
2784
  };
2714
- $8tj43$delegateEvents(["click"]);
2785
+ /**
2786
+ * Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
2787
+ */
2788
+ function $830ea8efda59884e$var$adjust_sizes(container_width, sizes, set_cols_at_size) {
2789
+ let current_row_index = 0;
2790
+ let current_row_items = [];
2791
+ const column_to_row_result = {};
2792
+ const check_would_fit_evenly = (min_size_of_item, at_number_of_columnns) => {
2793
+ const would_have_even_size = container_width / at_number_of_columnns - (at_number_of_columnns * 2 - 2) * ($830ea8efda59884e$var$gap_px / 2) / at_number_of_columnns; // What size would our element have (without gaps), given that now every column had the same width (equation from Layout.tsx)
2794
+ return would_have_even_size >= min_size_of_item; // would this item still fit if we added another column? (probably what the caller has done with at_number_of_columns), given that every item has the same size
2795
+ };
2796
+
2797
+ for (const size_item of sizes) {
2798
+ const size = size_item();
2799
+ if (size == undefined) return; // Only do stuff if we know all the sizes
2800
+ const current_row_length = current_row_items.length;
2801
+ const can_add_another_column_initial_val = current_row_length < $830ea8efda59884e$var$max_columns; // allow max 4 items per row
2802
+ let can_add_another_column = can_add_another_column_initial_val;
2803
+ if (can_add_another_column)
2804
+ // can we actually? Since adding another column changes the size of all elements in the row we need to check all of them
2805
+ for (let i = -1; i < current_row_length; i++) {
2806
+ var _ref3;
2807
+ // -1 is for the new item we're adding and every item is guaranteed to exist
2808
+ const size_to_check = (_ref3 = current_row_items[i]) !== null && _ref3 !== void 0 ? _ref3 : size;
2809
+ const would_have_columns = current_row_length + 1; // if we added another column
2810
+ const would_fit_evenly = check_would_fit_evenly(size_to_check, would_have_columns); // see comments in check_would_fit_evenly
2811
+ if (!would_fit_evenly) {
2812
+ can_add_another_column = false;
2813
+ break;
2814
+ }
2815
+ }
2816
+ if (can_add_another_column) current_row_items.push(size);else {
2817
+ column_to_row_result[++current_row_index] = current_row_length || 1; // overrides is indexed by 1 it seems, therefore ++curent_row_index
2818
+ current_row_items = [size]; // save current item for next row
2819
+ }
2820
+ }
2821
+
2822
+ const items_left_to_add = current_row_items.length;
2823
+ if (items_left_to_add) {
2824
+ let num_columns = 1; // We want to have as close to max_columns as possible in the last row
2825
+ let fits = true;
2826
+ do
2827
+ // Check if more columns would fit
2828
+ for (let i = 0; i < items_left_to_add; i++) {
2829
+ const item = current_row_items[i];
2830
+ const would_fit_evenly = check_would_fit_evenly(item, num_columns + 1);
2831
+ if (!would_fit_evenly) {
2832
+ fits = false;
2833
+ break;
2834
+ }
2835
+ } while (fits && ++num_columns < $830ea8efda59884e$var$max_columns);
2836
+ column_to_row_result[++current_row_index] = num_columns; // Add last row that's left after loop finished
2837
+ }
2838
+
2839
+ set_cols_at_size([[1, "0px", "", null, {
2840
+ overrides: column_to_row_result
2841
+ }]]);
2842
+ }
2715
2843
  function $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query) {
2716
2844
  const signal = $8tj43$createSignal(false);
2717
2845
  $8tj43$onCleanup($8tj43$javascript_media_query(media_query, _ref => {
@@ -2770,7 +2898,7 @@ function $2cb856c297c53e6c$export$82ed4b28ecb67608(_ref) {
2770
2898
  });
2771
2899
  const rgb_color = $8tj43$createMemo(() => $8tj43$hex_to_rgb(hex_color()));
2772
2900
  const black_contrast_better = $8tj43$createMemo(() => rgb_color() ? $2cb856c297c53e6c$var$does_black_contrast_better(rgb_color()) : false);
2773
- const input_row = $8tj43$createComponent((0, $6b73914551534ea8$export$48513f6b9f8ce62d), {
2901
+ const input_row = $8tj43$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
2774
2902
  get value_() {
2775
2903
  return checkbox().value_;
2776
2904
  },
@@ -11486,4 +11614,4 @@ const $d399250dfa491636$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
11486
11614
  const $d399250dfa491636$export$864d304a0bc46829 = "2%";
11487
11615
  const $d399250dfa491636$export$7bf543b9d9be2c22 = (0, $fa332ea03168857c$export$b91cec6bdc6b32a1);
11488
11616
  $8tj43$add_to_version_info("ui", (0, $8db9a15135765c11$export$83d89fbfd8236492));
11489
- export { $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $56047603f9d212b6$export$e6fffe67d4cdd848 as makeSizeAccessor, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $5c5732ef44f05b26$export$58e808b1db15d3bc as fetchDepictRecommendations, $f5f54892fd0c7d9f$export$de035477d6fef996 as QuickLinks, $f5f54892fd0c7d9f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $96fd967c5b358ead$export$643598a327b5833e as get_categories, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $f5f54892fd0c7d9f$export$e2bf8ce7779e827e as CategoryPage, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $eb064bc3350276c1$export$316f6f283ae64765 as SearchField, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version };
11617
+ export { $0dc044cffe1e825b$export$9f191182275e9ef as make_accurate_size_accessor, $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $56047603f9d212b6$export$e6fffe67d4cdd848 as makeSizeAccessor, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $5c5732ef44f05b26$export$58e808b1db15d3bc as fetchDepictRecommendations, $f5f54892fd0c7d9f$export$de035477d6fef996 as QuickLinks, $f5f54892fd0c7d9f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $96fd967c5b358ead$export$643598a327b5833e as get_categories, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $f5f54892fd0c7d9f$export$e2bf8ce7779e827e as CategoryPage, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $eb064bc3350276c1$export$316f6f283ae64765 as SearchField, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version };