@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/ES10/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { add_to_version_info as $8tj43$add_to_version_info, useExpandingContainer as $8tj43$useExpandingContainer, fetch_retry as $8tj43$fetch_retry, base_url as $8tj43$base_url, dwarn as $8tj43$dwarn, slider_fractional_factory as $8tj43$slider_fractional_factory, dlog as $8tj43$dlog, camelCasifyObject as $8tj43$camelCasifyObject, 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, slider_fading_factory as $8tj43$slider_fading_factory, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, observer as $8tj43$observer, javascript_media_query as $8tj43$javascript_media_query, queueMacroTask as $8tj43$queueMacroTask, findMostFrequentItem as $8tj43$findMostFrequentItem, standard_price_format as $8tj43$standard_price_format, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, deparallelize_no_drop as $8tj43$deparallelize_no_drop, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, use_href_accessor as $8tj43$use_href_accessor, get_session_id as $8tj43$get_session_id, add_version_query_params as $8tj43$add_version_query_params, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, snakeCasifyObject as $8tj43$snakeCasifyObject, make_url_with_query_params as $8tj43$make_url_with_query_params, sort_obj as $8tj43$sort_obj, insert_surfaces as $8tj43$insert_surfaces, is_debug as $8tj43$is_debug } from "@depict-ai/utilishared/ES10";
2
- import { createComponent as $8tj43$createComponent, insert as $8tj43$insert, template as $8tj43$template, getNextElement as $8tj43$getNextElement, mergeProps as $8tj43$mergeProps, effect as $8tj43$effect, className as $8tj43$className, isServer as $8tj43$isServer, spread as $8tj43$spread, runHydrationEvents as $8tj43$runHydrationEvents, addEventListener as $8tj43$addEventListener, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, getNextMarker as $8tj43$getNextMarker, classList as $8tj43$classList, setAttribute as $8tj43$setAttribute, style as $8tj43$style, use as $8tj43$use, setProperty as $8tj43$setProperty, Dynamic as $8tj43$Dynamic } from "solid-js/web";
2
+ import { createComponent as $8tj43$createComponent, insert as $8tj43$insert, template as $8tj43$template, getNextElement as $8tj43$getNextElement, mergeProps as $8tj43$mergeProps, effect as $8tj43$effect, className as $8tj43$className, isServer as $8tj43$isServer, spread as $8tj43$spread, runHydrationEvents as $8tj43$runHydrationEvents, addEventListener as $8tj43$addEventListener, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, getNextMarker as $8tj43$getNextMarker, classList as $8tj43$classList, setAttribute as $8tj43$setAttribute, use as $8tj43$use, style as $8tj43$style, setProperty as $8tj43$setProperty, Dynamic as $8tj43$Dynamic } from "solid-js/web";
3
3
  import { createSignal as $8tj43$createSignal, createMemo as $8tj43$createMemo, createResource as $8tj43$createResource, createEffect as $8tj43$createEffect, Show as $8tj43$Show, mergeProps as $8tj43$mergeProps1, Suspense as $8tj43$Suspense, untrack as $8tj43$untrack, createRenderEffect as $8tj43$createRenderEffect, Index as $8tj43$Index, createRoot as $8tj43$createRoot, onCleanup as $8tj43$onCleanup, For as $8tj43$For, getOwner as $8tj43$getOwner, runWithOwner as $8tj43$runWithOwner, createContext as $8tj43$createContext, useContext as $8tj43$useContext, createUniqueId as $8tj43$createUniqueId, createComputed as $8tj43$createComputed, ErrorBoundary as $8tj43$ErrorBoundary, splitProps as $8tj43$splitProps, on as $8tj43$on, batch as $8tj43$batch, createSelector as $8tj43$createSelector, children as $8tj43$children, createReaction as $8tj43$createReaction, mapArray as $8tj43$mapArray } from "solid-js";
4
4
  import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import { ListenableSet as $8tj43$ListenableSet, catchify as $8tj43$catchify1, use_href_accessor as $8tj43$use_href_accessor1, queueMacroTask as $8tj43$queueMacroTask1, report as $8tj43$report1 } from "@depict-ai/utilishared/ES10";
@@ -10,7 +10,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "4.7.7";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.7.9";
14
14
  function $8e8b179489080711$export$5bad61ecde080b1f() {
15
15
  const {
16
16
  collapse: collapse,
@@ -652,25 +652,27 @@ function $ca6ab5f08bd28bca$export$8be2714ec7f169ee() {
652
652
  }
653
653
  var $002f09d00aac50b2$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div>`),
654
654
  $002f09d00aac50b2$var$_tmpl$2 = /*#__PURE__*/$8tj43$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>`);
655
- function $002f09d00aac50b2$export$6649caad96ef8870(_ref) {
656
- let {
657
- children: children,
655
+ const $002f09d00aac50b2$var$SlidableContext = /*@__PURE__*/$8tj43$createContext();
656
+ function $002f09d00aac50b2$export$6649caad96ef8870(props) {
657
+ const {
658
658
  slider_ref_: slider_ref_,
659
659
  faded_opacity_ = 0.7,
660
660
  mutation_plugins_ = [],
661
661
  disable_fading_: disable_fading_,
662
- arrow_width_: arrow_width_,
663
- arrow_height_: arrow_height_,
664
662
  snapAlign_: snapAlign_,
665
663
  fadingThreshold_ = 0.96
666
- } = _ref;
664
+ } = props;
667
665
  const [hasHydrated, setHasHydrated] = $8tj43$createSignal(false);
668
666
  $8tj43$createEffect(() => setHasHydrated(true));
669
667
  const MakeButton = () => (() => {
670
668
  var _el$ = $8tj43$getNextElement($002f09d00aac50b2$var$_tmpl$);
671
669
  $8tj43$insert(_el$, $8tj43$createComponent((0, $ca6ab5f08bd28bca$export$8be2714ec7f169ee), {
672
- height_: arrow_height_,
673
- width_: arrow_width_
670
+ get height_() {
671
+ return props.arrow_height_;
672
+ },
673
+ get width_() {
674
+ return props.arrow_width_;
675
+ }
674
676
  }));
675
677
  return _el$;
676
678
  })();
@@ -690,12 +692,13 @@ function $002f09d00aac50b2$export$6649caad96ef8870(_ref) {
690
692
  _el$5 = _el$4.nextSibling;
691
693
  $8tj43$insert(_el$3, $8tj43$createComponent(MakeButton, {}));
692
694
  $8tj43$insert(_el$4, $8tj43$createComponent(MakeButton, {}));
693
- $8tj43$insert(_el$5, children);
695
+ $8tj43$insert(_el$5, () => props.children);
694
696
  return _el$2;
695
697
  })();
696
698
  },
697
699
  get children() {
698
700
  return (() => {
701
+ const [intersectionEntries_, setIntersectionEntries] = $8tj43$createSignal([]);
699
702
  const fading_plugin = disable_fading_ ? undefined : $8tj43$slider_fading_factory({
700
703
  threshold_: fadingThreshold_,
701
704
  faded_opacity_: faded_opacity_
@@ -708,9 +711,17 @@ function $002f09d00aac50b2$export$6649caad96ef8870(_ref) {
708
711
  constructor_plugins: [$8tj43$slider_snap_css(0, {
709
712
  align: snapAlign_
710
713
  }).constructor_plugin, ...(fading_plugin ? [fading_plugin.constructor_plugin] : [])],
711
- mutation_plugins: [...(fading_plugin ? [fading_plugin.mutation_plugin_] : []), ...mutation_plugins_]
714
+ mutation_plugins: [...(fading_plugin ? [fading_plugin.mutation_plugin_] : []), ...mutation_plugins_, entries => setIntersectionEntries(entries)]
712
715
  });
713
- $8tj43$insert(slider.insert_here, children);
716
+ $8tj43$insert(slider.insert_here, () => $8tj43$createComponent($002f09d00aac50b2$var$SlidableContext.Provider, {
717
+ value: {
718
+ slider_: slider,
719
+ intersectionEntries_: intersectionEntries_
720
+ },
721
+ get children() {
722
+ return props.children;
723
+ }
724
+ }));
714
725
  $8tj43$onCleanup(() => slider.observer.disconnect());
715
726
  slider_ref_ === null || slider_ref_ === void 0 || slider_ref_(slider);
716
727
  return slider.container;
@@ -718,6 +729,9 @@ function $002f09d00aac50b2$export$6649caad96ef8870(_ref) {
718
729
  }
719
730
  });
720
731
  }
732
+ function $002f09d00aac50b2$export$eaa625fb39439e37() {
733
+ return $8tj43$useContext($002f09d00aac50b2$var$SlidableContext);
734
+ }
721
735
  var $39ddb986053fb759$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<h2 class=recs-title>`);
722
736
  function $39ddb986053fb759$export$d41d19e89346fa2(_ref) {
723
737
  let {
@@ -901,38 +915,6 @@ function $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query) {
901
915
  }).remove);
902
916
  return signal[0];
903
917
  }
904
-
905
- /** @jsxImportSource solid-js */
906
-
907
- function $fc830a7ee59416ef$export$ebdc3711f7e02ccd(what_to_watch) {
908
- const [width, setWidth] = $8tj43$createSignal();
909
- const resizeObserver = new ResizeObserver($8tj43$catchify(records => {
910
- for (let j = 0; j < records.length; j++) {
911
- var _records$j$borderBoxS, _records$j$borderBoxS2, _records$j$borderBoxS3;
912
- 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;
913
- setWidth(width);
914
- }
915
- }));
916
- // 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.
917
- // It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
918
- const disconnect = (0, $8tj43$observer).onexists(what_to_watch, _ref => {
919
- let {
920
- element: element
921
- } = _ref;
922
- return requestAnimationFrame($8tj43$catchify(() => {
923
- const current_size = what_to_watch.getBoundingClientRect().width;
924
- if (current_size)
925
- // 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.
926
- setWidth(current_size);
927
- resizeObserver.observe(element);
928
- }));
929
- });
930
- $8tj43$onCleanup(() => {
931
- resizeObserver.disconnect();
932
- disconnect();
933
- });
934
- return width;
935
- }
936
918
  function $ceafb6fb91c6f394$export$89c6019e4baa40b1(props) {
937
919
  const style = $8tj43$createMemo(() => {
938
920
  const {
@@ -1096,9 +1078,10 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
1096
1078
  });
1097
1079
  // 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
1098
1080
  // Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
1099
- const executeWhenIdleBatched = fn => {
1081
+ const executeWhenIdleBatched = (fn, isSizesUpdate) => {
1100
1082
  if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
1101
- if ($8tj43$untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately
1083
+ if ((!isSizesUpdate || !sizeSetFastPath) && $8tj43$untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately (improves lighthouse metrics)
1084
+ // 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)
1102
1085
  const existingStack = listingContext === null || listingContext === void 0 ? void 0 : listingContext[$56047603f9d212b6$var$onIdleFunctionsSymbol];
1103
1086
  if (existingStack) return existingStack.add(fn);
1104
1087
  const newStack = new Set([fn]);
@@ -1183,10 +1166,11 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
1183
1166
  // This greatly improves performance when loading (more) products
1184
1167
  // See https://depictaiworkspace.slack.com/archives/C05NJ0K3WRL/p1698220617663139
1185
1168
  timeoutSet = true; // Important to set timeoutSet before the call to executeWhenIdleBatched since if this is an important image executeWhenIdleBatched will execute fn immediately
1186
- executeWhenIdleBatched(handler);
1169
+ executeWhenIdleBatched(handler, true);
1187
1170
  });
1171
+ const dontLoadImageYet = $8tj43$createMemo(() => !props.size() || !hasSetSize()); // Moving this condition into a memo saves us from re-setting src and srcset (expensive) if just props.size changes
1188
1172
  $8tj43$createEffect(() => {
1189
- 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
1173
+ 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
1190
1174
  Object.assign(img, src_options());
1191
1175
  // Add to DOM once decoded to not require/block any paints before image has completed loading and avoid showing broken image symbol
1192
1176
  // We can do this because there has to be a container around us giving us a size
@@ -1202,7 +1186,7 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
1202
1186
  img.decode().catch(e => $8tj43$dwarn("Failed to decode image", e, img)) // Display the image also if loading failed so webdev can debug and doesn't get "no image"
1203
1187
  .then(async () => {
1204
1188
  // Also wait with inserting image (i.e. paint) until browser is idle
1205
- await new Promise(r => executeWhenIdleBatched(r));
1189
+ await new Promise(r => executeWhenIdleBatched(r, false));
1206
1190
  if (gotCleanedUp) return;
1207
1191
  setHasDecoded(true);
1208
1192
  hasDecodedFastPath = true;
@@ -1556,7 +1540,7 @@ var $72017ebd8b9df947$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div style=posi
1556
1540
  let $72017ebd8b9df947$var$cachedValue;
1557
1541
  async function $72017ebd8b9df947$export$7b9a0e99f0aeb2f3() {
1558
1542
  if ($72017ebd8b9df947$var$cachedValue != undefined) return $72017ebd8b9df947$var$cachedValue;
1559
- return $72017ebd8b9df947$var$cachedValue = await $72017ebd8b9df947$var$checkIfIsAffectedByChromeBug326498383();
1543
+ return $72017ebd8b9df947$var$cachedValue = $72017ebd8b9df947$var$checkIfIsAffectedByChromeBug326498383();
1560
1544
  }
1561
1545
  async function $72017ebd8b9df947$var$checkIfIsAffectedByChromeBug326498383() {
1562
1546
  let isAffected = true;
@@ -1569,7 +1553,7 @@ async function $72017ebd8b9df947$var$checkIfIsAffectedByChromeBug326498383() {
1569
1553
  setTimeout($8tj43$catchify(() => {
1570
1554
  r();
1571
1555
  div.remove();
1572
- }), 200);
1556
+ }), 500);
1573
1557
  });
1574
1558
  const {
1575
1559
  style: style
@@ -1612,7 +1596,8 @@ function $4089a7972a508539$export$ebf0b1d4f90c09ae(_ref) {
1612
1596
  animationDuration_: animationDuration_,
1613
1597
  supportsHover_: supportsHover_,
1614
1598
  priceFormatting_: priceFormatting_,
1615
- pseudoRouter_: pseudoRouter_
1599
+ pseudoRouter_: pseudoRouter_,
1600
+ containerHeight_: containerHeight_
1616
1601
  } = _ref;
1617
1602
  let isAffectedByChromeBug = false;
1618
1603
  // If the user requests the drawer to be expanded or not
@@ -1632,6 +1617,8 @@ function $4089a7972a508539$export$ebf0b1d4f90c09ae(_ref) {
1632
1617
  get children() {
1633
1618
  var _el$ = $8tj43$getNextElement($4089a7972a508539$var$_tmpl$),
1634
1619
  _el$2 = _el$.firstChild;
1620
+ $8tj43$addEventListener(_el$2, "mouseleave", $8tj43$catchify(() => supportsHover_() && setUserWantsExpanded(false)));
1621
+ $8tj43$addEventListener(_el$2, "mouseenter", $8tj43$catchify(() => supportsHover_() && setUserWantsExpanded(true)));
1635
1622
  $8tj43$use(el => $8tj43$createEffect(() => {
1636
1623
  if (userWantsExpanded()) return;
1637
1624
  if (isAffectedByChromeBug) {
@@ -1643,22 +1630,6 @@ function $4089a7972a508539$export$ebf0b1d4f90c09ae(_ref) {
1643
1630
  behavior: "smooth"
1644
1631
  });
1645
1632
  }), _el$2);
1646
- $8tj43$spread(_el$2, $8tj43$mergeProps({
1647
- get classList() {
1648
- return {
1649
- expanded: userWantsExpanded(),
1650
- "resting-fully-expanded": !getSecondPartAnimationRunning() && userWantsExpanded()
1651
- };
1652
- },
1653
- get onMouseEnter() {
1654
- return $8tj43$catchify(() => supportsHover_() && setUserWantsExpanded(true));
1655
- },
1656
- get onMouseLeave() {
1657
- return $8tj43$catchify(() => supportsHover_() && setUserWantsExpanded(false));
1658
- }
1659
- }, () => displays_() && {
1660
- style: "--look-card-width:".concat(containerWidth_(), "px;--look-item-height:").concat(lookItemHeight() || 200, "px")
1661
- }), false, true);
1662
1633
  $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Index), {
1663
1634
  get each() {
1664
1635
  return displays_() || Array.from({
@@ -1683,7 +1654,21 @@ function $4089a7972a508539$export$ebf0b1d4f90c09ae(_ref) {
1683
1654
  });
1684
1655
  }
1685
1656
  }));
1686
- $8tj43$runHydrationEvents();
1657
+ $8tj43$effect(_p$ => {
1658
+ var _v$ = !!userWantsExpanded(),
1659
+ _v$2 = !!(!getSecondPartAnimationRunning() && userWantsExpanded()),
1660
+ _v$3 = displays_() &&
1661
+ // The styling is written like this to eke out animation smoothness on low CPU devices, git blame for previous, more readable versions.
1662
+ "--look-card-width:".concat(containerWidth_(), "px;--look-card-height:").concat(containerHeight_(), "px;--look-item-height:").concat(lookItemHeight() || 200, "px");
1663
+ _v$ !== _p$.e && _el$2.classList.toggle("expanded", _p$.e = _v$);
1664
+ _v$2 !== _p$.t && _el$2.classList.toggle("resting-fully-expanded", _p$.t = _v$2);
1665
+ _p$.a = $8tj43$style(_el$2, _v$3, _p$.a);
1666
+ return _p$;
1667
+ }, {
1668
+ e: undefined,
1669
+ t: undefined,
1670
+ a: undefined
1671
+ });
1687
1672
  return _el$;
1688
1673
  }
1689
1674
  });
@@ -1710,7 +1695,7 @@ function $4089a7972a508539$var$scrollingFunctionForChrome(element, targetScrollY
1710
1695
  // Bootstrap our animation - it will get called right before next frame shall be rendered.
1711
1696
  requestAnimationFrame(step);
1712
1697
  }
1713
- var $697d8713dc82b9ab$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=look-card>`);
1698
+ var $697d8713dc82b9ab$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=look-card><!$><!/><!$><!/>`);
1714
1699
  function $697d8713dc82b9ab$export$44809a8a3e867e30(_ref) {
1715
1700
  let {
1716
1701
  display_: display_,
@@ -1721,31 +1706,23 @@ function $697d8713dc82b9ab$export$44809a8a3e867e30(_ref) {
1721
1706
  priceFormatting_: priceFormatting_,
1722
1707
  pseudoRouter_: pseudoRouter_
1723
1708
  } = _ref;
1709
+ let container;
1724
1710
  const useWantsExpandedSignal_ = $8tj43$createSignal(false);
1725
1711
  const [userWantsExpanded, setUserWantsExpanded] = useWantsExpandedSignal_;
1726
1712
  const supportsHover_ = $00a5b94f0c11efbb$export$d9f36cf74e24d595("(hover: hover) and (pointer: fine)");
1727
1713
  const us = Symbol("look");
1728
- const container = (() => {
1729
- var _el$ = $8tj43$getNextElement($697d8713dc82b9ab$var$_tmpl$);
1730
- $8tj43$addEventListener(_el$, "click", $8tj43$catchify(_ref2 => {
1731
- let {
1732
- target: target
1733
- } = _ref2;
1734
- return setUserWantsExpanded(prev => !prev);
1735
- }), true);
1736
- $8tj43$effect(() => _el$.classList.toggle("placeholder", !display_()));
1737
- $8tj43$runHydrationEvents();
1738
- return _el$;
1739
- })();
1740
- const containerWidth_ = $fc830a7ee59416ef$export$ebdc3711f7e02ccd(container);
1741
- const clickHandler = $8tj43$catchify(_ref3 => {
1714
+ const index = $1e69163caedaab4e$export$e3faf4d95300054f();
1715
+ const [containerWidth_, setContainerWidth] = $8tj43$createSignal();
1716
+ const [containerHeight_, setContainerHeight] = $8tj43$createSignal();
1717
+ const clickHandler = $8tj43$catchify(_ref2 => {
1742
1718
  let {
1743
1719
  target: target
1744
- } = _ref3;
1720
+ } = _ref2;
1745
1721
  if (target !== container && !container.contains(target))
1746
1722
  // When clicking outside the look, close it
1747
1723
  setUserWantsExpanded(false);
1748
1724
  });
1725
+ const slidableInformation = $002f09d00aac50b2$export$eaa625fb39439e37();
1749
1726
  addEventListener("click", clickHandler);
1750
1727
  $8tj43$onCleanup(() => removeEventListener("click", clickHandler));
1751
1728
  $8tj43$createEffect(() => setExpandedLooks(prev => {
@@ -1757,41 +1734,87 @@ function $697d8713dc82b9ab$export$44809a8a3e867e30(_ref) {
1757
1734
  } else prev.delete(us);
1758
1735
  return prev;
1759
1736
  }));
1737
+ if (slidableInformation) {
1738
+ const ourVisiblityInSlider = $8tj43$createMemo(() => {
1739
+ var _slidableInformation$, _slidableInformation$2;
1740
+ const currentCard = index === null || index === void 0 ? void 0 : index();
1741
+ if (isNaN(currentCard)) return;
1742
+ slidableInformation === null || slidableInformation === void 0 || slidableInformation.intersectionEntries_();
1743
+ return slidableInformation === null || slidableInformation === void 0 ? void 0 : (_slidableInformation$ = slidableInformation.slider_.intersecting_items_object) === null || _slidableInformation$ === void 0 ? void 0 : (_slidableInformation$2 = _slidableInformation$[currentCard]) === null || _slidableInformation$2 === void 0 ? void 0 : _slidableInformation$2.intersectionRatio;
1744
+ });
1745
+ $8tj43$createEffect(prevVisibility => {
1746
+ // Have memo -> effect setup for diffing, so we do as little work as possible in unrelated cards
1747
+ // as number is safe because undefined and NaN are both not < 0.5
1748
+ const visibility = ourVisiblityInSlider();
1749
+ if (visibility < 0.5 && (isNaN(prevVisibility) || visibility - prevVisibility < 0))
1750
+ // When sliding this card completely into the background, collapse it
1751
+ // 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
1752
+ setUserWantsExpanded(false);
1753
+ return visibility;
1754
+ });
1755
+ }
1760
1756
  // Close us if another look expands
1761
1757
  $8tj43$createEffect(() => !expandedLooks_().has(us) && setUserWantsExpanded(false));
1762
- $8tj43$insert(container, () => [$8tj43$createComponent((0, $8tj43$Show), {
1763
- get when() {
1764
- return display_();
1765
- },
1766
- get fallback() {
1767
- return $8tj43$createComponent((0, $3ab4aa97880fb88d$export$3f37af283f8fb843), {
1768
- aspectRatio: "var(".concat((0, $5eaa00b951637e96$export$8a2234b5b1a5ebd4), ", ").concat(placeholderImageAspectRatio_, ")")
1769
- });
1770
- },
1771
- get children() {
1772
- return $8tj43$createComponent((0, $98688279b9059f50$export$9d4a4b669b1929ab), {
1773
- get src() {
1774
- var _display_, _display_$image_urls;
1775
- return (_display_ = display_()) === null || _display_ === void 0 ? void 0 : (_display_$image_urls = _display_.image_urls) === null || _display_$image_urls === void 0 ? void 0 : _display_$image_urls[0];
1776
- },
1777
- aspectRatio: placeholderImageAspectRatio_,
1778
- autoAdjustAspectRatio: true
1779
- });
1780
- }
1781
- }), $8tj43$createComponent((0, $4089a7972a508539$export$ebf0b1d4f90c09ae), {
1782
- displays_: () => {
1783
- var _display_2;
1784
- return (_display_2 = display_()) === null || _display_2 === void 0 ? void 0 : _display_2.displays;
1785
- },
1786
- userWantsExpandedSignal_: useWantsExpandedSignal_,
1787
- containerWidth_: containerWidth_,
1788
- animationDuration_: animationDuration_,
1789
- supportsHover_: supportsHover_,
1790
- FavoriteButton_: FavoriteButton_,
1791
- priceFormatting_: priceFormatting_,
1792
- pseudoRouter_: pseudoRouter_
1793
- })]);
1794
- return container;
1758
+ return (() => {
1759
+ var _el$ = $8tj43$getNextElement($697d8713dc82b9ab$var$_tmpl$),
1760
+ _el$2 = _el$.firstChild,
1761
+ [_el$3, _co$] = $8tj43$getNextMarker(_el$2.nextSibling),
1762
+ _el$4 = _el$3.nextSibling,
1763
+ [_el$5, _co$2] = $8tj43$getNextMarker(_el$4.nextSibling);
1764
+ $8tj43$addEventListener(_el$, "click", $8tj43$catchify(() => setUserWantsExpanded(prev => !prev)), true);
1765
+ $8tj43$use(el => {
1766
+ container = el;
1767
+ const ro = new ResizeObserver($8tj43$catchify(records => {
1768
+ const last = records.at(-1);
1769
+ if (!last) return;
1770
+ const {
1771
+ width: width,
1772
+ height: height
1773
+ } = last.contentRect;
1774
+ setContainerWidth(width);
1775
+ setContainerHeight(height);
1776
+ }));
1777
+ ro.observe(el);
1778
+ $8tj43$onCleanup(() => ro.disconnect());
1779
+ }, _el$);
1780
+ _el$.classList.toggle("placeholder", !!!display_);
1781
+ $8tj43$insert(_el$, $8tj43$createComponent((0, $8tj43$Show), {
1782
+ get when() {
1783
+ return display_();
1784
+ },
1785
+ get fallback() {
1786
+ return $8tj43$createComponent((0, $3ab4aa97880fb88d$export$3f37af283f8fb843), {
1787
+ aspectRatio: "var(".concat((0, $5eaa00b951637e96$export$8a2234b5b1a5ebd4), ", ").concat(placeholderImageAspectRatio_, ")")
1788
+ });
1789
+ },
1790
+ get children() {
1791
+ return $8tj43$createComponent((0, $98688279b9059f50$export$9d4a4b669b1929ab), {
1792
+ get src() {
1793
+ var _display_, _display_$image_urls;
1794
+ return (_display_ = display_()) === null || _display_ === void 0 ? void 0 : (_display_$image_urls = _display_.image_urls) === null || _display_$image_urls === void 0 ? void 0 : _display_$image_urls[0];
1795
+ },
1796
+ aspectRatio: placeholderImageAspectRatio_,
1797
+ autoAdjustAspectRatio: true
1798
+ });
1799
+ }
1800
+ }), _el$3, _co$);
1801
+ $8tj43$insert(_el$, $8tj43$createComponent((0, $4089a7972a508539$export$ebf0b1d4f90c09ae), {
1802
+ displays_: () => {
1803
+ var _display_2;
1804
+ return (_display_2 = display_()) === null || _display_2 === void 0 ? void 0 : _display_2.displays;
1805
+ },
1806
+ userWantsExpandedSignal_: useWantsExpandedSignal_,
1807
+ containerWidth_: containerWidth_,
1808
+ animationDuration_: animationDuration_,
1809
+ supportsHover_: supportsHover_,
1810
+ FavoriteButton_: FavoriteButton_,
1811
+ priceFormatting_: priceFormatting_,
1812
+ pseudoRouter_: pseudoRouter_,
1813
+ containerHeight_: containerHeight_
1814
+ }), _el$5, _co$2);
1815
+ $8tj43$runHydrationEvents();
1816
+ return _el$;
1817
+ })();
1795
1818
  }
1796
1819
  $8tj43$delegateEvents(["click"]);
1797
1820
 
@@ -3554,6 +3577,38 @@ let $c3820807ac1e6fd7$export$44dad306455dddf;
3554
3577
  DEPICT_ID["SEARCH_PAGE"] = "depict-search-page";
3555
3578
  DEPICT_ID["PLP_CATEGORY"] = "depict-plp-category";
3556
3579
  })($c3820807ac1e6fd7$export$44dad306455dddf || ($c3820807ac1e6fd7$export$44dad306455dddf = {}));
3580
+
3581
+ /** @jsxImportSource solid-js */
3582
+
3583
+ function $fc830a7ee59416ef$export$ebdc3711f7e02ccd(what_to_watch) {
3584
+ const [width, setWidth] = $8tj43$createSignal();
3585
+ const resizeObserver = new ResizeObserver($8tj43$catchify(records => {
3586
+ for (let j = 0; j < records.length; j++) {
3587
+ var _records$j$borderBoxS, _records$j$borderBoxS2, _records$j$borderBoxS3;
3588
+ 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;
3589
+ setWidth(width);
3590
+ }
3591
+ }));
3592
+ // 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.
3593
+ // It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
3594
+ const disconnect = (0, $8tj43$observer).onexists(what_to_watch, _ref => {
3595
+ let {
3596
+ element: element
3597
+ } = _ref;
3598
+ return requestAnimationFrame($8tj43$catchify(() => {
3599
+ const current_size = what_to_watch.getBoundingClientRect().width;
3600
+ if (current_size)
3601
+ // 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.
3602
+ setWidth(current_size);
3603
+ resizeObserver.observe(element);
3604
+ }));
3605
+ });
3606
+ $8tj43$onCleanup(() => {
3607
+ resizeObserver.disconnect();
3608
+ disconnect();
3609
+ });
3610
+ return width;
3611
+ }
3557
3612
  var $83c36ed4520d0335$var$_tmpl$ = /*#__PURE__*/$8tj43$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>`);
3558
3613
  function $83c36ed4520d0335$export$f7658c347b037c3f() {
3559
3614
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};