@depict-ai/ui 4.7.7 → 4.7.9

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { add_to_version_info as $9HbP8$add_to_version_info, useExpandingContainer as $9HbP8$useExpandingContainer, fetch_retry as $9HbP8$fetch_retry, base_url as $9HbP8$base_url, dwarn as $9HbP8$dwarn, 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, catchify as $9HbP8$catchify, 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, slider_fading_factory as $9HbP8$slider_fading_factory, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, observer as $9HbP8$observer, javascript_media_query as $9HbP8$javascript_media_query, queueMacroTask as $9HbP8$queueMacroTask, findMostFrequentItem as $9HbP8$findMostFrequentItem, standard_price_format as $9HbP8$standard_price_format, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, use_href_accessor as $9HbP8$use_href_accessor, get_session_id as $9HbP8$get_session_id, add_version_query_params as $9HbP8$add_version_query_params, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, snakeCasifyObject as $9HbP8$snakeCasifyObject, sort_obj as $9HbP8$sort_obj, make_url_with_query_params as $9HbP8$make_url_with_query_params, insert_surfaces as $9HbP8$insert_surfaces, is_debug as $9HbP8$is_debug } from "@depict-ai/utilishared/latest";
2
- import { createComponent as $9HbP8$createComponent, insert as $9HbP8$insert, template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, mergeProps as $9HbP8$mergeProps, effect as $9HbP8$effect, className as $9HbP8$className, isServer as $9HbP8$isServer, spread as $9HbP8$spread, runHydrationEvents as $9HbP8$runHydrationEvents, addEventListener as $9HbP8$addEventListener, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, getNextMarker as $9HbP8$getNextMarker, classList as $9HbP8$classList, setAttribute as $9HbP8$setAttribute, style as $9HbP8$style, use as $9HbP8$use, setProperty as $9HbP8$setProperty, Dynamic as $9HbP8$Dynamic } from "solid-js/web";
2
+ import { createComponent as $9HbP8$createComponent, insert as $9HbP8$insert, template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, mergeProps as $9HbP8$mergeProps, effect as $9HbP8$effect, className as $9HbP8$className, isServer as $9HbP8$isServer, spread as $9HbP8$spread, runHydrationEvents as $9HbP8$runHydrationEvents, addEventListener as $9HbP8$addEventListener, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, getNextMarker as $9HbP8$getNextMarker, classList as $9HbP8$classList, setAttribute as $9HbP8$setAttribute, use as $9HbP8$use, style as $9HbP8$style, setProperty as $9HbP8$setProperty, Dynamic as $9HbP8$Dynamic } from "solid-js/web";
3
3
  import { createSignal as $9HbP8$createSignal, createMemo as $9HbP8$createMemo, createResource as $9HbP8$createResource, createEffect as $9HbP8$createEffect, Show as $9HbP8$Show, mergeProps as $9HbP8$mergeProps1, Suspense as $9HbP8$Suspense, untrack as $9HbP8$untrack, createRenderEffect as $9HbP8$createRenderEffect, Index as $9HbP8$Index, createRoot as $9HbP8$createRoot, onCleanup as $9HbP8$onCleanup, For as $9HbP8$For, getOwner as $9HbP8$getOwner, runWithOwner as $9HbP8$runWithOwner, createContext as $9HbP8$createContext, useContext as $9HbP8$useContext, createUniqueId as $9HbP8$createUniqueId, createComputed as $9HbP8$createComputed, ErrorBoundary as $9HbP8$ErrorBoundary, splitProps as $9HbP8$splitProps, on as $9HbP8$on, batch as $9HbP8$batch, createSelector as $9HbP8$createSelector, children as $9HbP8$children, createReaction as $9HbP8$createReaction, mapArray as $9HbP8$mapArray } from "solid-js";
4
4
  import { ListenableSet as $9HbP8$ListenableSet, catchify as $9HbP8$catchify1, use_href_accessor as $9HbP8$use_href_accessor1, queueMacroTask as $9HbP8$queueMacroTask1, report as $9HbP8$report1 } from "@depict-ai/utilishared/latest";
5
5
  import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from "solid-js/store";
@@ -7,7 +7,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "4.7.7";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.7.9";
11
11
  function $24e27fab9c821b86$export$5bad61ecde080b1f(...params) {
12
12
  const {
13
13
  collapse: collapse,
@@ -610,24 +610,27 @@ function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
610
610
  }
611
611
  var $f32e14878e75af51$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div>`),
612
612
  $f32e14878e75af51$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<div class="depict-slider depict"><button aria-label="Scroll left"class="left d-navbutton"type=button></button><button aria-label="Scroll right"class="right d-navbutton"type=button></button><div class=sliding>`);
613
- function $f32e14878e75af51$export$6649caad96ef8870({
614
- children: children,
615
- slider_ref_: slider_ref_,
616
- faded_opacity_ = 0.7,
617
- mutation_plugins_ = [],
618
- disable_fading_: disable_fading_,
619
- arrow_width_: arrow_width_,
620
- arrow_height_: arrow_height_,
621
- snapAlign_: snapAlign_,
622
- fadingThreshold_ = 0.96
623
- }) {
613
+ const $f32e14878e75af51$var$SlidableContext = /*@__PURE__*/$9HbP8$createContext();
614
+ function $f32e14878e75af51$export$6649caad96ef8870(props) {
615
+ const {
616
+ slider_ref_: slider_ref_,
617
+ faded_opacity_ = 0.7,
618
+ mutation_plugins_ = [],
619
+ disable_fading_: disable_fading_,
620
+ snapAlign_: snapAlign_,
621
+ fadingThreshold_ = 0.96
622
+ } = props;
624
623
  const [hasHydrated, setHasHydrated] = $9HbP8$createSignal(false);
625
624
  $9HbP8$createEffect(() => setHasHydrated(true));
626
625
  const MakeButton = () => (() => {
627
626
  var _el$ = $9HbP8$getNextElement($f32e14878e75af51$var$_tmpl$);
628
627
  $9HbP8$insert(_el$, $9HbP8$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {
629
- height_: arrow_height_,
630
- width_: arrow_width_
628
+ get height_() {
629
+ return props.arrow_height_;
630
+ },
631
+ get width_() {
632
+ return props.arrow_width_;
633
+ }
631
634
  }));
632
635
  return _el$;
633
636
  })();
@@ -647,12 +650,13 @@ function $f32e14878e75af51$export$6649caad96ef8870({
647
650
  _el$5 = _el$4.nextSibling;
648
651
  $9HbP8$insert(_el$3, $9HbP8$createComponent(MakeButton, {}));
649
652
  $9HbP8$insert(_el$4, $9HbP8$createComponent(MakeButton, {}));
650
- $9HbP8$insert(_el$5, children);
653
+ $9HbP8$insert(_el$5, () => props.children);
651
654
  return _el$2;
652
655
  })();
653
656
  },
654
657
  get children() {
655
658
  return (() => {
659
+ const [intersectionEntries_, setIntersectionEntries] = $9HbP8$createSignal([]);
656
660
  const fading_plugin = disable_fading_ ? undefined : $9HbP8$slider_fading_factory({
657
661
  threshold_: fadingThreshold_,
658
662
  faded_opacity_: faded_opacity_
@@ -665,9 +669,17 @@ function $f32e14878e75af51$export$6649caad96ef8870({
665
669
  constructor_plugins: [$9HbP8$slider_snap_css(0, {
666
670
  align: snapAlign_
667
671
  }).constructor_plugin, ...(fading_plugin ? [fading_plugin.constructor_plugin] : [])],
668
- mutation_plugins: [...(fading_plugin ? [fading_plugin.mutation_plugin_] : []), ...mutation_plugins_]
672
+ mutation_plugins: [...(fading_plugin ? [fading_plugin.mutation_plugin_] : []), ...mutation_plugins_, entries => setIntersectionEntries(entries)]
669
673
  });
670
- $9HbP8$insert(slider.insert_here, children);
674
+ $9HbP8$insert(slider.insert_here, () => $9HbP8$createComponent($f32e14878e75af51$var$SlidableContext.Provider, {
675
+ value: {
676
+ slider_: slider,
677
+ intersectionEntries_: intersectionEntries_
678
+ },
679
+ get children() {
680
+ return props.children;
681
+ }
682
+ }));
671
683
  $9HbP8$onCleanup(() => slider.observer.disconnect());
672
684
  slider_ref_?.(slider);
673
685
  return slider.container;
@@ -675,6 +687,9 @@ function $f32e14878e75af51$export$6649caad96ef8870({
675
687
  }
676
688
  });
677
689
  }
690
+ function $f32e14878e75af51$export$eaa625fb39439e37() {
691
+ return $9HbP8$useContext($f32e14878e75af51$var$SlidableContext);
692
+ }
678
693
  var $c4492d24952ed731$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<h2 class=recs-title>`);
679
694
  function $c4492d24952ed731$export$d41d19e89346fa2({
680
695
  recommendations_resource_: recommendations_resource_,
@@ -850,34 +865,6 @@ function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
850
865
  }) => signal[1](matches)).remove);
851
866
  return signal[0];
852
867
  }
853
-
854
- /** @jsxImportSource solid-js */
855
-
856
- function $2449872a62a75a20$export$ebdc3711f7e02ccd(what_to_watch) {
857
- const [width, setWidth] = $9HbP8$createSignal();
858
- const resizeObserver = new ResizeObserver($9HbP8$catchify(records => {
859
- for (let j = 0; j < records.length; j++) {
860
- const width = records[j].borderBoxSize?.[0]?.inlineSize ?? what_to_watch.getBoundingClientRect().width;
861
- setWidth(width);
862
- }
863
- }));
864
- // If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
865
- // It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
866
- const disconnect = (0, $9HbP8$observer).onexists(what_to_watch, ({
867
- element: element
868
- }) => requestAnimationFrame($9HbP8$catchify(() => {
869
- const current_size = what_to_watch.getBoundingClientRect().width;
870
- if (current_size)
871
- // If element has size, set signal to that. ResizeObserver only triggers when the content is visible in some cases, but it might already have a size. This reduces size filter expanding animation jank in chrome.
872
- setWidth(current_size);
873
- resizeObserver.observe(element);
874
- })));
875
- $9HbP8$onCleanup(() => {
876
- resizeObserver.disconnect();
877
- disconnect();
878
- });
879
- return width;
880
- }
881
868
  function $d134eae24341b4a1$export$89c6019e4baa40b1(props) {
882
869
  const style = $9HbP8$createMemo(() => {
883
870
  const {
@@ -1037,9 +1024,10 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
1037
1024
  });
1038
1025
  // Batch idle callbacks so that MutationObserver can batch the resulting mutations better, so we don't lose tons of CPU time to MutationObservers doing lots of things for each image
1039
1026
  // Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
1040
- const executeWhenIdleBatched = fn => {
1027
+ const executeWhenIdleBatched = (fn, isSizesUpdate) => {
1041
1028
  if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
1042
- if ($9HbP8$untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately
1029
+ if ((!isSizesUpdate || !sizeSetFastPath) && $9HbP8$untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately (improves lighthouse metrics)
1030
+ // unless we're just a `sizes` update after the initial sizes setting (this optimisation makes the looks animation a lot smoother on low-cpu devices)
1043
1031
  const existingStack = listingContext?.[$e8ffe11ed01df0fe$var$onIdleFunctionsSymbol];
1044
1032
  if (existingStack) return existingStack.add(fn);
1045
1033
  const newStack = new Set([fn]);
@@ -1121,10 +1109,11 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
1121
1109
  // This greatly improves performance when loading (more) products
1122
1110
  // See https://depictaiworkspace.slack.com/archives/C05NJ0K3WRL/p1698220617663139
1123
1111
  timeoutSet = true; // Important to set timeoutSet before the call to executeWhenIdleBatched since if this is an important image executeWhenIdleBatched will execute fn immediately
1124
- executeWhenIdleBatched(handler);
1112
+ executeWhenIdleBatched(handler, true);
1125
1113
  });
1114
+ const dontLoadImageYet = $9HbP8$createMemo(() => !props.size() || !hasSetSize()); // Moving this condition into a memo saves us from re-setting src and srcset (expensive) if just props.size changes
1126
1115
  $9HbP8$createEffect(() => {
1127
- if (!props.size() || !hasSetSize()) return; // If size isn't known or set, don't assign src yet since it would cause the most low res image to load
1116
+ if (dontLoadImageYet()) return; // If size isn't known or set, don't assign src yet since it would cause the most low res image to load
1128
1117
  Object.assign(img, src_options());
1129
1118
  // Add to DOM once decoded to not require/block any paints before image has completed loading and avoid showing broken image symbol
1130
1119
  // We can do this because there has to be a container around us giving us a size
@@ -1140,7 +1129,7 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
1140
1129
  img.decode().catch(e => $9HbP8$dwarn("Failed to decode image", e, img)) // Display the image also if loading failed so webdev can debug and doesn't get "no image"
1141
1130
  .then(async () => {
1142
1131
  // Also wait with inserting image (i.e. paint) until browser is idle
1143
- await new Promise(r => executeWhenIdleBatched(r));
1132
+ await new Promise(r => executeWhenIdleBatched(r, false));
1144
1133
  if (gotCleanedUp) return;
1145
1134
  setHasDecoded(true);
1146
1135
  hasDecodedFastPath = true;
@@ -1471,7 +1460,7 @@ var $62a8f670f8464532$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div style=posi
1471
1460
  let $62a8f670f8464532$var$cachedValue;
1472
1461
  async function $62a8f670f8464532$export$7b9a0e99f0aeb2f3() {
1473
1462
  if ($62a8f670f8464532$var$cachedValue != undefined) return $62a8f670f8464532$var$cachedValue;
1474
- return $62a8f670f8464532$var$cachedValue = await $62a8f670f8464532$var$checkIfIsAffectedByChromeBug326498383();
1463
+ return $62a8f670f8464532$var$cachedValue = $62a8f670f8464532$var$checkIfIsAffectedByChromeBug326498383();
1475
1464
  }
1476
1465
  async function $62a8f670f8464532$var$checkIfIsAffectedByChromeBug326498383() {
1477
1466
  let isAffected = true;
@@ -1484,7 +1473,7 @@ async function $62a8f670f8464532$var$checkIfIsAffectedByChromeBug326498383() {
1484
1473
  setTimeout($9HbP8$catchify(() => {
1485
1474
  r();
1486
1475
  div.remove();
1487
- }), 200);
1476
+ }), 500);
1488
1477
  });
1489
1478
  const {
1490
1479
  style: style
@@ -1526,7 +1515,8 @@ function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
1526
1515
  animationDuration_: animationDuration_,
1527
1516
  supportsHover_: supportsHover_,
1528
1517
  priceFormatting_: priceFormatting_,
1529
- pseudoRouter_: pseudoRouter_
1518
+ pseudoRouter_: pseudoRouter_,
1519
+ containerHeight_: containerHeight_
1530
1520
  }) {
1531
1521
  let isAffectedByChromeBug = false;
1532
1522
  // If the user requests the drawer to be expanded or not
@@ -1546,6 +1536,8 @@ function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
1546
1536
  get children() {
1547
1537
  var _el$ = $9HbP8$getNextElement($7555dcad3b8a4632$var$_tmpl$),
1548
1538
  _el$2 = _el$.firstChild;
1539
+ $9HbP8$addEventListener(_el$2, "mouseleave", $9HbP8$catchify(() => supportsHover_() && setUserWantsExpanded(false)));
1540
+ $9HbP8$addEventListener(_el$2, "mouseenter", $9HbP8$catchify(() => supportsHover_() && setUserWantsExpanded(true)));
1549
1541
  $9HbP8$use(el => $9HbP8$createEffect(() => {
1550
1542
  if (userWantsExpanded()) return;
1551
1543
  if (isAffectedByChromeBug) {
@@ -1557,22 +1549,6 @@ function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
1557
1549
  behavior: "smooth"
1558
1550
  });
1559
1551
  }), _el$2);
1560
- $9HbP8$spread(_el$2, $9HbP8$mergeProps({
1561
- get classList() {
1562
- return {
1563
- expanded: userWantsExpanded(),
1564
- "resting-fully-expanded": !getSecondPartAnimationRunning() && userWantsExpanded()
1565
- };
1566
- },
1567
- get onMouseEnter() {
1568
- return $9HbP8$catchify(() => supportsHover_() && setUserWantsExpanded(true));
1569
- },
1570
- get onMouseLeave() {
1571
- return $9HbP8$catchify(() => supportsHover_() && setUserWantsExpanded(false));
1572
- }
1573
- }, () => displays_() && {
1574
- style: `--look-card-width:${containerWidth_()}px;--look-item-height:${lookItemHeight() || 200}px`
1575
- }), false, true);
1576
1552
  $9HbP8$insert(_el$2, $9HbP8$createComponent((0, $9HbP8$Index), {
1577
1553
  get each() {
1578
1554
  return displays_() || Array.from({
@@ -1597,7 +1573,21 @@ function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
1597
1573
  });
1598
1574
  }
1599
1575
  }));
1600
- $9HbP8$runHydrationEvents();
1576
+ $9HbP8$effect(_p$ => {
1577
+ var _v$ = !!userWantsExpanded(),
1578
+ _v$2 = !!(!getSecondPartAnimationRunning() && userWantsExpanded()),
1579
+ _v$3 = displays_() &&
1580
+ // The styling is written like this to eke out animation smoothness on low CPU devices, git blame for previous, more readable versions.
1581
+ `--look-card-width:${containerWidth_()}px;--look-card-height:${containerHeight_()}px;--look-item-height:${lookItemHeight() || 200}px`;
1582
+ _v$ !== _p$.e && _el$2.classList.toggle("expanded", _p$.e = _v$);
1583
+ _v$2 !== _p$.t && _el$2.classList.toggle("resting-fully-expanded", _p$.t = _v$2);
1584
+ _p$.a = $9HbP8$style(_el$2, _v$3, _p$.a);
1585
+ return _p$;
1586
+ }, {
1587
+ e: undefined,
1588
+ t: undefined,
1589
+ a: undefined
1590
+ });
1601
1591
  return _el$;
1602
1592
  }
1603
1593
  });
@@ -1624,7 +1614,7 @@ function $7555dcad3b8a4632$var$scrollingFunctionForChrome(element, targetScrollY
1624
1614
  // Bootstrap our animation - it will get called right before next frame shall be rendered.
1625
1615
  requestAnimationFrame(step);
1626
1616
  }
1627
- var $28ee4f7db3cc44b8$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=look-card>`);
1617
+ var $28ee4f7db3cc44b8$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=look-card><!$><!/><!$><!/>`);
1628
1618
  function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
1629
1619
  display_: display_,
1630
1620
  expandedLooksSignal_: [expandedLooks_, setExpandedLooks],
@@ -1634,20 +1624,14 @@ function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
1634
1624
  priceFormatting_: priceFormatting_,
1635
1625
  pseudoRouter_: pseudoRouter_
1636
1626
  }) {
1627
+ let container;
1637
1628
  const useWantsExpandedSignal_ = $9HbP8$createSignal(false);
1638
1629
  const [userWantsExpanded, setUserWantsExpanded] = useWantsExpandedSignal_;
1639
1630
  const supportsHover_ = $dc9262ef6f786812$export$d9f36cf74e24d595("(hover: hover) and (pointer: fine)");
1640
1631
  const us = Symbol("look");
1641
- const container = (() => {
1642
- var _el$ = $9HbP8$getNextElement($28ee4f7db3cc44b8$var$_tmpl$);
1643
- $9HbP8$addEventListener(_el$, "click", $9HbP8$catchify(({
1644
- target: target
1645
- }) => setUserWantsExpanded(prev => !prev)), true);
1646
- $9HbP8$effect(() => _el$.classList.toggle("placeholder", !display_()));
1647
- $9HbP8$runHydrationEvents();
1648
- return _el$;
1649
- })();
1650
- const containerWidth_ = $2449872a62a75a20$export$ebdc3711f7e02ccd(container);
1632
+ const index = $b6440e72ed83671a$export$e3faf4d95300054f();
1633
+ const [containerWidth_, setContainerWidth] = $9HbP8$createSignal();
1634
+ const [containerHeight_, setContainerHeight] = $9HbP8$createSignal();
1651
1635
  const clickHandler = $9HbP8$catchify(({
1652
1636
  target: target
1653
1637
  }) => {
@@ -1655,6 +1639,7 @@ function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
1655
1639
  // When clicking outside the look, close it
1656
1640
  setUserWantsExpanded(false);
1657
1641
  });
1642
+ const slidableInformation = $f32e14878e75af51$export$eaa625fb39439e37();
1658
1643
  addEventListener("click", clickHandler);
1659
1644
  $9HbP8$onCleanup(() => removeEventListener("click", clickHandler));
1660
1645
  $9HbP8$createEffect(() => setExpandedLooks(prev => {
@@ -1666,37 +1651,82 @@ function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
1666
1651
  } else prev.delete(us);
1667
1652
  return prev;
1668
1653
  }));
1654
+ if (slidableInformation) {
1655
+ const ourVisiblityInSlider = $9HbP8$createMemo(() => {
1656
+ const currentCard = index?.();
1657
+ if (isNaN(currentCard)) return;
1658
+ slidableInformation?.intersectionEntries_();
1659
+ return slidableInformation?.slider_.intersecting_items_object?.[currentCard]?.intersectionRatio;
1660
+ });
1661
+ $9HbP8$createEffect(prevVisibility => {
1662
+ // Have memo -> effect setup for diffing, so we do as little work as possible in unrelated cards
1663
+ // as number is safe because undefined and NaN are both not < 0.5
1664
+ const visibility = ourVisiblityInSlider();
1665
+ if (visibility < 0.5 && (isNaN(prevVisibility) || visibility - prevVisibility < 0))
1666
+ // When sliding this card completely into the background, collapse it
1667
+ // Don't collapse it if we're about to put it more into visibility, to fix what's described at the end of https://www.loom.com/share/8796209c68764b18a0d565010929f594
1668
+ setUserWantsExpanded(false);
1669
+ return visibility;
1670
+ });
1671
+ }
1669
1672
  // Close us if another look expands
1670
1673
  $9HbP8$createEffect(() => !expandedLooks_().has(us) && setUserWantsExpanded(false));
1671
- $9HbP8$insert(container, () => [$9HbP8$createComponent((0, $9HbP8$Show), {
1672
- get when() {
1673
- return display_();
1674
- },
1675
- get fallback() {
1676
- return $9HbP8$createComponent((0, $7f60f09116a3fe61$export$3f37af283f8fb843), {
1677
- aspectRatio: `var(${(0, $bb15dfb548a7666e$export$8a2234b5b1a5ebd4)}, ${placeholderImageAspectRatio_})`
1678
- });
1679
- },
1680
- get children() {
1681
- return $9HbP8$createComponent((0, $70bb27cc6be01fc7$export$9d4a4b669b1929ab), {
1682
- get src() {
1683
- return display_()?.image_urls?.[0];
1684
- },
1685
- aspectRatio: placeholderImageAspectRatio_,
1686
- autoAdjustAspectRatio: true
1687
- });
1688
- }
1689
- }), $9HbP8$createComponent((0, $7555dcad3b8a4632$export$ebf0b1d4f90c09ae), {
1690
- displays_: () => display_()?.displays,
1691
- userWantsExpandedSignal_: useWantsExpandedSignal_,
1692
- containerWidth_: containerWidth_,
1693
- animationDuration_: animationDuration_,
1694
- supportsHover_: supportsHover_,
1695
- FavoriteButton_: FavoriteButton_,
1696
- priceFormatting_: priceFormatting_,
1697
- pseudoRouter_: pseudoRouter_
1698
- })]);
1699
- return container;
1674
+ return (() => {
1675
+ var _el$ = $9HbP8$getNextElement($28ee4f7db3cc44b8$var$_tmpl$),
1676
+ _el$2 = _el$.firstChild,
1677
+ [_el$3, _co$] = $9HbP8$getNextMarker(_el$2.nextSibling),
1678
+ _el$4 = _el$3.nextSibling,
1679
+ [_el$5, _co$2] = $9HbP8$getNextMarker(_el$4.nextSibling);
1680
+ $9HbP8$addEventListener(_el$, "click", $9HbP8$catchify(() => setUserWantsExpanded(prev => !prev)), true);
1681
+ $9HbP8$use(el => {
1682
+ container = el;
1683
+ const ro = new ResizeObserver($9HbP8$catchify(records => {
1684
+ const last = records.at(-1);
1685
+ if (!last) return;
1686
+ const {
1687
+ width: width,
1688
+ height: height
1689
+ } = last.contentRect;
1690
+ setContainerWidth(width);
1691
+ setContainerHeight(height);
1692
+ }));
1693
+ ro.observe(el);
1694
+ $9HbP8$onCleanup(() => ro.disconnect());
1695
+ }, _el$);
1696
+ _el$.classList.toggle("placeholder", !!!display_);
1697
+ $9HbP8$insert(_el$, $9HbP8$createComponent((0, $9HbP8$Show), {
1698
+ get when() {
1699
+ return display_();
1700
+ },
1701
+ get fallback() {
1702
+ return $9HbP8$createComponent((0, $7f60f09116a3fe61$export$3f37af283f8fb843), {
1703
+ aspectRatio: `var(${(0, $bb15dfb548a7666e$export$8a2234b5b1a5ebd4)}, ${placeholderImageAspectRatio_})`
1704
+ });
1705
+ },
1706
+ get children() {
1707
+ return $9HbP8$createComponent((0, $70bb27cc6be01fc7$export$9d4a4b669b1929ab), {
1708
+ get src() {
1709
+ return display_()?.image_urls?.[0];
1710
+ },
1711
+ aspectRatio: placeholderImageAspectRatio_,
1712
+ autoAdjustAspectRatio: true
1713
+ });
1714
+ }
1715
+ }), _el$3, _co$);
1716
+ $9HbP8$insert(_el$, $9HbP8$createComponent((0, $7555dcad3b8a4632$export$ebf0b1d4f90c09ae), {
1717
+ displays_: () => display_()?.displays,
1718
+ userWantsExpandedSignal_: useWantsExpandedSignal_,
1719
+ containerWidth_: containerWidth_,
1720
+ animationDuration_: animationDuration_,
1721
+ supportsHover_: supportsHover_,
1722
+ FavoriteButton_: FavoriteButton_,
1723
+ priceFormatting_: priceFormatting_,
1724
+ pseudoRouter_: pseudoRouter_,
1725
+ containerHeight_: containerHeight_
1726
+ }), _el$5, _co$2);
1727
+ $9HbP8$runHydrationEvents();
1728
+ return _el$;
1729
+ })();
1700
1730
  }
1701
1731
  $9HbP8$delegateEvents(["click"]);
1702
1732
 
@@ -3360,6 +3390,34 @@ let $f86ba724282f6690$export$44dad306455dddf;
3360
3390
  DEPICT_ID["SEARCH_PAGE"] = "depict-search-page";
3361
3391
  DEPICT_ID["PLP_CATEGORY"] = "depict-plp-category";
3362
3392
  })($f86ba724282f6690$export$44dad306455dddf || ($f86ba724282f6690$export$44dad306455dddf = {}));
3393
+
3394
+ /** @jsxImportSource solid-js */
3395
+
3396
+ function $2449872a62a75a20$export$ebdc3711f7e02ccd(what_to_watch) {
3397
+ const [width, setWidth] = $9HbP8$createSignal();
3398
+ const resizeObserver = new ResizeObserver($9HbP8$catchify(records => {
3399
+ for (let j = 0; j < records.length; j++) {
3400
+ const width = records[j].borderBoxSize?.[0]?.inlineSize ?? what_to_watch.getBoundingClientRect().width;
3401
+ setWidth(width);
3402
+ }
3403
+ }));
3404
+ // If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
3405
+ // It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
3406
+ const disconnect = (0, $9HbP8$observer).onexists(what_to_watch, ({
3407
+ element: element
3408
+ }) => requestAnimationFrame($9HbP8$catchify(() => {
3409
+ const current_size = what_to_watch.getBoundingClientRect().width;
3410
+ if (current_size)
3411
+ // If element has size, set signal to that. ResizeObserver only triggers when the content is visible in some cases, but it might already have a size. This reduces size filter expanding animation jank in chrome.
3412
+ setWidth(current_size);
3413
+ resizeObserver.observe(element);
3414
+ })));
3415
+ $9HbP8$onCleanup(() => {
3416
+ resizeObserver.disconnect();
3417
+ disconnect();
3418
+ });
3419
+ return width;
3420
+ }
3363
3421
  var $081752ca508a876f$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<svg xmlns=http://www.w3.org/2000/svg width=21 height=20 viewBox="0 0 21 20"fill=none><path fill-rule=evenodd d="M9.563 3.438c-3.107 0-5.625 2.518-5.625 5.625s2.518 5.625 5.625 5.625 5.625-2.518 5.625-5.625-2.518-5.625-5.625-5.625zm-7.5 5.625a7.5 7.5 0 1 1 15 0c0 1.733-.588 3.329-1.575 4.599l3.176 3.176a.94.94 0 0 1 0 1.326.94.94 0 0 1-1.326 0l-3.176-3.176a7.47 7.47 0 0 1-4.599 1.575 7.5 7.5 0 0 1-7.5-7.5z"fill=#0f0f0f>`);
3364
3422
  function $081752ca508a876f$export$f7658c347b037c3f(props = {}) {
3365
3423
  return (() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "4.7.7",
3
+ "version": "4.7.9",
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",
@@ -236,9 +236,9 @@
236
236
  "@babel/plugin-transform-typescript": "^7.22.9",
237
237
  "@babel/runtime": "latest",
238
238
  "@babel/runtime-corejs3": "^7.22.6",
239
- "@depict-ai/plp-styling": "^4.4.2",
240
- "@depict-ai/types": "^5.4.1",
241
- "@depict-ai/utilishared": "^2.4.2",
239
+ "@depict-ai/plp-styling": "^4.4.4",
240
+ "@depict-ai/types": "^5.4.2",
241
+ "@depict-ai/utilishared": "^2.4.3",
242
242
  "solid-js": "^1.8.12"
243
243
  },
244
244
  "type": "module",