@depict-ai/ui 4.0.7 → 4.0.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.
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "4.0.7";
13
+ export const version = "4.0.9";
14
14
  export type ModalAlignmentSignals = {
15
15
  body_: Signal<JSX.CSSProperties>;
16
16
  field_: Signal<JSX.CSSProperties>;
@@ -388,6 +388,17 @@ export function ImageContainer(props: {
388
388
  class?: string;
389
389
  children?: JSX.Element;
390
390
  }): HTMLDivElement;
391
+ /**
392
+ * Provider to wrap every product card that gets rendered in (in PLPResults rendering internals), enables using useProductCardIndex anywhere inside the product card to get the index of the product card.
393
+ */
394
+ export function ProductCardIndexProvider(props: {
395
+ children: JSX.Element;
396
+ index_: Accessor<number>;
397
+ }): JSX.Element;
398
+ /**
399
+ * Use this to get an accessor containing the index of your product card.
400
+ */
401
+ export function useProductCardIndex(): Accessor<number> | undefined;
391
402
  /**
392
403
  * Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
393
404
  */
@@ -395,6 +406,7 @@ export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
395
406
  /**
396
407
  * Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
397
408
  * Will also delay loading and decoding of image until the browser is idle (with 5s timeout) to improve filtering/loading more performance.
409
+ * If ran within Depict product card rendering, within one of the first 8 product cards, those images will be loaded immediately and loading="lazy" will be ignored for them (unless you set it to "force-lazy").
398
410
  * This is used for our responsive images:
399
411
  * 1. The image must have a container with a fixed size (or aspect ratio) that is independent of the image. When aspectRatio is configured on the depict-cards element as data attribute, we will wrap the image in a ImageContainer for this. If it's false, the user has to provide this container themselves.
400
412
  * 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
@@ -404,8 +416,9 @@ export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
404
416
  export function ShopifyResponsiveImg(props: {
405
417
  resolutions?: number[];
406
418
  size: Accessor<number>;
407
- } & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes"> & {
419
+ } & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes" | "loading"> & {
408
420
  src: string;
421
+ loading?: "eager" | "lazy" | "force-lazy";
409
422
  }): JSX.Element;
410
423
  type ImagePlaceholderBaseOptions = {
411
424
  style?: JSX.CSSProperties;
@@ -1194,7 +1207,7 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
1194
1207
  on_listing_query_change?: (new_listing_query?: ListingQuery | undefined, old_listing_query?: ListingQuery | undefined) => void;
1195
1208
  content_blocks_by_row?: ContentBlocksByRow;
1196
1209
  layout?: PossibleLayout;
1197
- }): import("@depict-ai/utilishared").Node_Array;
1210
+ }): import("@depict-ai/utilishared/latest").Node_Array;
1198
1211
  export function BreadCrumbs<T extends Display>({
1199
1212
  depict_category
1200
1213
  }: {
@@ -1326,7 +1339,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
1326
1339
  * Open the modal with support for alignment.
1327
1340
  * @returns {void}
1328
1341
  */
1329
- export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1342
+ export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends ModernDisplay>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1330
1343
  export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
1331
1344
  export interface PageReplacer {
1332
1345
  readonly render_: () => Node_Array;
@@ -1,13 +1,13 @@
1
- import { add_to_version_info as $i7OB2$add_to_version_info, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, catchify as $i7OB2$catchify, make_random_classname as $i7OB2$make_random_classname, ContainedImage as $i7OB2$ContainedImage, standard_price_format as $i7OB2$standard_price_format, javascript_media_query as $i7OB2$javascript_media_query, dlog as $i7OB2$dlog, camelCasifyObject as $i7OB2$camelCasifyObject, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, observer as $i7OB2$observer, report as $i7OB2$report, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, ListenableSet as $i7OB2$ListenableSet, findMostFrequentItem as $i7OB2$findMostFrequentItem, queueMacroTask as $i7OB2$queueMacroTask, dwarn as $i7OB2$dwarn, slider_fading_factory as $i7OB2$slider_fading_factory, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, use_href_accessor as $i7OB2$use_href_accessor, get_session_id as $i7OB2$get_session_id, add_version_query_params as $i7OB2$add_version_query_params, base_url as $i7OB2$base_url, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, slider_fractional_factory as $i7OB2$slider_fractional_factory, useExpandingContainer as $i7OB2$useExpandingContainer, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, snakeCasifyObject as $i7OB2$snakeCasifyObject, fetch_retry as $i7OB2$fetch_retry, sort_obj as $i7OB2$sort_obj, make_url_with_query_params as $i7OB2$make_url_with_query_params, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
2
- import { createSignal as $i7OB2$createSignal, createResource as $i7OB2$createResource, createEffect as $i7OB2$createEffect, untrack as $i7OB2$untrack, createMemo as $i7OB2$createMemo, onCleanup as $i7OB2$onCleanup, Show as $i7OB2$Show, createComputed as $i7OB2$createComputed, For as $i7OB2$For, getOwner as $i7OB2$getOwner, runWithOwner as $i7OB2$runWithOwner, on as $i7OB2$on, Index as $i7OB2$Index, batch as $i7OB2$batch, ErrorBoundary as $i7OB2$ErrorBoundary, createContext as $i7OB2$createContext, useContext as $i7OB2$useContext, mergeProps as $i7OB2$mergeProps1, createUniqueId as $i7OB2$createUniqueId, createRenderEffect as $i7OB2$createRenderEffect, createSelector as $i7OB2$createSelector, children as $i7OB2$children, splitProps as $i7OB2$splitProps, createRoot as $i7OB2$createRoot, Suspense as $i7OB2$Suspense, createReaction as $i7OB2$createReaction, mapArray as $i7OB2$mapArray } from "solid-js";
1
+ import { add_to_version_info as $i7OB2$add_to_version_info, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, catchify as $i7OB2$catchify, make_random_classname as $i7OB2$make_random_classname, ContainedImage as $i7OB2$ContainedImage, standard_price_format as $i7OB2$standard_price_format, javascript_media_query as $i7OB2$javascript_media_query, dlog as $i7OB2$dlog, camelCasifyObject as $i7OB2$camelCasifyObject, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, observer as $i7OB2$observer, report as $i7OB2$report, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, queueMacroTask as $i7OB2$queueMacroTask, findMostFrequentItem as $i7OB2$findMostFrequentItem, dwarn as $i7OB2$dwarn, slider_fading_factory as $i7OB2$slider_fading_factory, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, use_href_accessor as $i7OB2$use_href_accessor, get_session_id as $i7OB2$get_session_id, add_version_query_params as $i7OB2$add_version_query_params, base_url as $i7OB2$base_url, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, slider_fractional_factory as $i7OB2$slider_fractional_factory, useExpandingContainer as $i7OB2$useExpandingContainer, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, snakeCasifyObject as $i7OB2$snakeCasifyObject, fetch_retry as $i7OB2$fetch_retry, sort_obj as $i7OB2$sort_obj, make_url_with_query_params as $i7OB2$make_url_with_query_params, ListenableSet as $i7OB2$ListenableSet1, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
2
+ import { createSignal as $i7OB2$createSignal, createResource as $i7OB2$createResource, createEffect as $i7OB2$createEffect, untrack as $i7OB2$untrack, createMemo as $i7OB2$createMemo, onCleanup as $i7OB2$onCleanup, Show as $i7OB2$Show, createComputed as $i7OB2$createComputed, For as $i7OB2$For, getOwner as $i7OB2$getOwner, runWithOwner as $i7OB2$runWithOwner, createContext as $i7OB2$createContext, useContext as $i7OB2$useContext, on as $i7OB2$on, Index as $i7OB2$Index, batch as $i7OB2$batch, ErrorBoundary as $i7OB2$ErrorBoundary, splitProps as $i7OB2$splitProps, mergeProps as $i7OB2$mergeProps1, createUniqueId as $i7OB2$createUniqueId, createRenderEffect as $i7OB2$createRenderEffect, createSelector as $i7OB2$createSelector, children as $i7OB2$children, createRoot as $i7OB2$createRoot, Suspense as $i7OB2$Suspense, createReaction as $i7OB2$createReaction, mapArray as $i7OB2$mapArray } from "solid-js";
3
3
  import { ssr as $i7OB2$ssr, ssrHydrationKey as $i7OB2$ssrHydrationKey, escape as $i7OB2$escape, createComponent as $i7OB2$createComponent, ssrAttribute as $i7OB2$ssrAttribute, ssrClassList as $i7OB2$ssrClassList, ssrStyle as $i7OB2$ssrStyle, ssrElement as $i7OB2$ssrElement, mergeProps as $i7OB2$mergeProps, insert as $i7OB2$insert, spread as $i7OB2$spread, isServer as $i7OB2$isServer, Dynamic as $i7OB2$Dynamic } from "solid-js/web";
4
- import { ListenableSet as $i7OB2$ListenableSet1, catchify as $i7OB2$catchify1, use_href_accessor as $i7OB2$use_href_accessor1, report as $i7OB2$report1 } from "@depict-ai/utilishared/latest";
4
+ import { ListenableSet as $i7OB2$ListenableSet, catchify as $i7OB2$catchify1, use_href_accessor as $i7OB2$use_href_accessor1, report as $i7OB2$report1 } from "@depict-ai/utilishared/latest";
5
5
  import { createStore as $i7OB2$createStore, reconcile as $i7OB2$reconcile } from "solid-js/store";
6
6
 
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.0.7";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.0.9";
11
11
  function $136f1d4d6c7ba6ac$export$e417c49320921907(dependency, fetcher) {
12
12
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $i7OB2$createSignal();
13
13
  const deparallelizedFetcher = $i7OB2$deparallelize_no_drop(async dependencyValue => {
@@ -245,6 +245,20 @@ function $a52235d12ccf9c88$var$unwrapping_helper(elements) {
245
245
  } else if (typeof elements == "function") result.push(...$a52235d12ccf9c88$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
246
246
  return result;
247
247
  }
248
+ const $b6440e72ed83671a$var$ProductCardIndexContext = /*@__PURE__*/$i7OB2$createContext();
249
+ function $b6440e72ed83671a$export$11354f017ddc9790(props) {
250
+ return $i7OB2$createComponent($b6440e72ed83671a$var$ProductCardIndexContext.Provider, {
251
+ get value() {
252
+ return props.index_;
253
+ },
254
+ get children() {
255
+ return props.children;
256
+ }
257
+ });
258
+ }
259
+ function $b6440e72ed83671a$export$e3faf4d95300054f() {
260
+ return $i7OB2$useContext($b6440e72ed83671a$var$ProductCardIndexContext);
261
+ }
248
262
  let $29ec7cddbe1d3484$var$printedCloneError = false;
249
263
  function $29ec7cddbe1d3484$export$7f8bd308237ab5a5(get_displays_) {
250
264
  const displays_by_key_ = $i7OB2$createMemo(() => {
@@ -298,9 +312,22 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
298
312
  $i7OB2$dlog("Can't clone display", display, " (uncloneable objects in it), make sure you don't mutate it in the template since we cache.", e);
299
313
  }
300
314
  }
301
- return product_card_template_(display, {
302
- set_on_index_change: fn => $i7OB2$runWithOwner(owner, () => $i7OB2$createEffect(() => fn(index())))
315
+ let renderingResult;
316
+ // Wrap the product card in a ProductCardIndexProvider so that the index is available to the product card
317
+ // This is wo we can do intelligent image loading in ShopifyContainedImage without shopify devs having to pass in the index
318
+ // We don't care about the return value of ProductCardIndexProvider because our rendering result might be a promise which solid doesn't support until it has gone through createResource
319
+ $b6440e72ed83671a$export$11354f017ddc9790({
320
+ index_: index,
321
+ get children() {
322
+ // This is the key - the functions called inside of the children getter of the provider are the one that have the context defined in their solid-internal Owner
323
+ renderingResult = product_card_template_(display, {
324
+ set_on_index_change: fn => $i7OB2$runWithOwner(owner, () => $i7OB2$createEffect(() => fn(index())))
325
+ });
326
+ return undefined; // just to satisfy the typing
327
+ }
303
328
  });
329
+ // renderingResult is guaranteed to be defined here (if rendering returned something) because the children getter of ProductCardIndexProvider is called synchronously (createRenderEffect is used solid-internally)
330
+ return renderingResult;
304
331
  });
305
332
  const node_accessor = $a52235d12ccf9c88$export$2f0cbfbb4354bb52(product_card_resource);
306
333
  $i7OB2$createEffect(() => {
@@ -325,7 +352,8 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
325
352
  });
326
353
  return [
327
354
  // Show content block before product card, so it's *at* that index
328
- possible_content_block, product_card_resource]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
355
+ possible_content_block, node_accessor // Don't return product_card_resource as calling it could be creating the nodes which would mean we'd be double-creating the nodes,
356
+ ]; // Regarding the as unknown shenanigans: https://github.com/solidjs/solid/releases/tag/v1.7.0
329
357
  }
330
358
  });
331
359
  }
@@ -1762,6 +1790,33 @@ var $f18d425032111270$var$_tmpl$ = ["<div", ' class="', '" style="', '">', "</di
1762
1790
  function $f18d425032111270$export$94026ee33dbabc26(props) {
1763
1791
  return $i7OB2$ssr($f18d425032111270$var$_tmpl$, $i7OB2$ssrHydrationKey(), `${$i7OB2$escape($i7OB2$escape("s-image-container", true), true)} ${$i7OB2$escape(props.class, true) || ""}`, $i7OB2$ssrStyle(`padding-bottom:calc(calc(1 / ${props.aspectRatio}) * 100%)`), $i7OB2$escape(props.children));
1764
1792
  }
1793
+ let $4ea56971d92eb0cd$var$browserIsBugged = false;
1794
+ function $4ea56971d92eb0cd$export$2972b890694ced75(callback, {
1795
+ timeout: timeout
1796
+ }) {
1797
+ if ($4ea56971d92eb0cd$var$browserIsBugged) timeout /= 4;
1798
+ const cancel = () => {
1799
+ cancelIdleCallback(idleHandle);
1800
+ clearTimeout(racingTimeout);
1801
+ };
1802
+ const idleHandle = requestIdleCallback(deadline => {
1803
+ cancel();
1804
+ return callback(deadline);
1805
+ }, {
1806
+ timeout: timeout
1807
+ });
1808
+ const racingTimeout = setTimeout(() => {
1809
+ $4ea56971d92eb0cd$var$browserIsBugged = true;
1810
+ cancel();
1811
+ callback({
1812
+ didTimeout: false,
1813
+ timeRemaining() {
1814
+ return 500;
1815
+ }
1816
+ });
1817
+ }, timeout + 1000);
1818
+ return cancel;
1819
+ }
1765
1820
  function $e8ffe11ed01df0fe$export$e6fffe67d4cdd848(whatToWatch) {
1766
1821
  const [size, setSize] = $i7OB2$createSignal(0);
1767
1822
  const resizeObserver = new ResizeObserver($i7OB2$catchify(records => {
@@ -1786,23 +1841,11 @@ function $e8ffe11ed01df0fe$export$e6fffe67d4cdd848(whatToWatch) {
1786
1841
  }
1787
1842
  const $e8ffe11ed01df0fe$var$onIdleFunctionsSymbol = /*@__PURE__*/Symbol("onIdleFunctions");
1788
1843
  const $e8ffe11ed01df0fe$export$f8945274f08a3105 = /*@__PURE__*/Symbol("listingContextAspectRatios");
1844
+ const $e8ffe11ed01df0fe$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingContextAspectRatios");
1789
1845
  function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
1790
- // Enable reactive props
1791
- const otherOptions = $i7OB2$createMemo(() => {
1792
- const cloned_props = {
1793
- ...props
1794
- };
1795
- delete cloned_props.resolutions;
1796
- // @ts-ignore
1797
- delete cloned_props.size;
1798
- // @ts-ignore
1799
- delete cloned_props.src;
1800
- return cloned_props;
1801
- });
1802
1846
  const src_options = $i7OB2$createMemo(() => {
1803
- const src = new URL(props.src, location.origin);
1804
- const fallback_src = $e8ffe11ed01df0fe$var$generateImageUrl(src, 400);
1805
- const srcset = $e8ffe11ed01df0fe$var$make_srcset(src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096]);
1847
+ const fallback_src = $e8ffe11ed01df0fe$var$generateImageUrl(props.src, 400);
1848
+ const srcset = $e8ffe11ed01df0fe$var$make_srcset(props.src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096]);
1806
1849
  // The order here *might* matter - I've seen mobile safari always start with loading the 400px version when it was reversed
1807
1850
  return {
1808
1851
  srcset: srcset,
@@ -1811,19 +1854,35 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
1811
1854
  });
1812
1855
  // Work around https://github.com/solidjs/solid/issues/1828
1813
1856
  const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
1857
+ const [, otherAttributes] = $i7OB2$splitProps(props, ["resolutions", "size", "src", "srcSet", "loading"]);
1814
1858
  const [hasSetSize, setHasSetSize] = $i7OB2$createSignal(false);
1815
1859
  const [hasDecoded, setHasDecoded] = $i7OB2$createSignal(false);
1860
+ const productCardIndexAccessor = $b6440e72ed83671a$export$e3faf4d95300054f();
1816
1861
  const sizePX = $i7OB2$createMemo(() => `${props.size()}px`); // props.size could be a getter that expects a cleanup so get it in this memo instead of where we set img.sizes
1817
1862
  const listingContext = $011607bdf658f807$export$8d0c4fdbb05a2f2e();
1863
+ const isPrioritisedImage = $i7OB2$createMemo(() => productCardIndexAccessor?.() < 8);
1864
+ const shouldActuallyEnableLazyLoading = $i7OB2$createMemo(() => {
1865
+ const {
1866
+ loading: loading
1867
+ } = props;
1868
+ if (loading === "force-lazy") return true;
1869
+ return loading === "lazy" && !isPrioritisedImage();
1870
+ });
1871
+ const modifiedOtherAttributes = $i7OB2$mergeProps1(otherAttributes, {
1872
+ get loading() {
1873
+ return shouldActuallyEnableLazyLoading() ? "lazy" : undefined;
1874
+ }
1875
+ });
1818
1876
  // 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
1819
1877
  // Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
1820
1878
  const executeWhenIdleBatched = fn => {
1821
1879
  if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
1880
+ if ($i7OB2$untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately
1822
1881
  const existingStack = listingContext?.[$e8ffe11ed01df0fe$var$onIdleFunctionsSymbol];
1823
1882
  if (existingStack) return existingStack.add(fn);
1824
1883
  const newStack = new Set([fn]);
1825
1884
  if (listingContext) listingContext[$e8ffe11ed01df0fe$var$onIdleFunctionsSymbol] = newStack;
1826
- const processStackWhenIdle = () => requestIdleCallback(deadline => {
1885
+ const processStackWhenIdle = () => $4ea56971d92eb0cd$export$2972b890694ced75($i7OB2$catchify(deadline => {
1827
1886
  const start = performance.now();
1828
1887
  const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
1829
1888
  for (const fn of newStack) {
@@ -1838,7 +1897,7 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
1838
1897
  }
1839
1898
  // Stack is empty
1840
1899
  if (listingContext) delete listingContext[$e8ffe11ed01df0fe$var$onIdleFunctionsSymbol];
1841
- }, {
1900
+ }), {
1842
1901
  timeout: 15000
1843
1902
  } // long timeout, better to not have images than to freeze the browser. But also we don't want to confuse user why no iamges are loading
1844
1903
  );
@@ -1852,7 +1911,8 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
1852
1911
  img.classList.add("s-responsive-image");
1853
1912
  if (listingContext) {
1854
1913
  let prevValue;
1855
- const aspectRatios = listingContext[$e8ffe11ed01df0fe$export$f8945274f08a3105] ||= new (0, $i7OB2$ListenableSet)();
1914
+ const aspectRatios = listingContext[$e8ffe11ed01df0fe$export$f8945274f08a3105] ||= new Set();
1915
+ const [, setMostPrevalentAspectRatio] = listingContext[$e8ffe11ed01df0fe$export$6066eb417ed2e9f7] ||= $i7OB2$createSignal();
1856
1916
  img.addEventListener("load", $i7OB2$catchify(() => {
1857
1917
  // Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2
1858
1918
  const aspectRatio_ = img.naturalWidth / img.naturalHeight;
@@ -1862,13 +1922,19 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
1862
1922
  } : undefined;
1863
1923
  if (newValue) aspectRatios.add(newValue);
1864
1924
  prevValue = newValue;
1925
+ // Do all calculations resulting of an update directly, for performance
1926
+ const asArray = [...aspectRatios].map(({
1927
+ aspectRatio_: aspectRatio_
1928
+ }) => aspectRatio_);
1929
+ const mostPrevalentAspectRatio = $i7OB2$findMostFrequentItem(asArray);
1930
+ setMostPrevalentAspectRatio(mostPrevalentAspectRatio);
1865
1931
  }));
1866
1932
  $i7OB2$onCleanup(() => prevValue && aspectRatios.delete(prevValue));
1867
1933
  }
1868
1934
  $i7OB2$onCleanup(() => gotCleanedUp = true);
1869
- $i7OB2$spread(img, $i7OB2$mergeProps1(otherOptions), false, true);
1935
+ $i7OB2$spread(img, $i7OB2$mergeProps1(modifiedOtherAttributes), false, true);
1870
1936
  $i7OB2$createEffect(() => {
1871
- if (!props.size()) return; // wait until we have a size
1937
+ if (!props.size()) return; // wait until we have a size, run every time the size changes
1872
1938
  if (timeoutSet) return;
1873
1939
  const handler = $i7OB2$catchify(() => {
1874
1940
  if (gotCleanedUp) return;
@@ -1893,7 +1959,7 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
1893
1959
  // We can do this because there has to be a container around us giving us a size
1894
1960
  // No need to listen if we're already in the DOM
1895
1961
  if (hasDecodedFastPath) return;
1896
- if (props.loading === "lazy") {
1962
+ if (shouldActuallyEnableLazyLoading()) {
1897
1963
  // For lazy loading there's no decoding to wait for as it only occurs when the image is visible
1898
1964
  // Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
1899
1965
  setHasDecoded(true);
@@ -1920,9 +1986,10 @@ function $e8ffe11ed01df0fe$var$make_srcset(url, resolutions) {
1920
1986
  return resolutions.map(width => `${$e8ffe11ed01df0fe$var$generateImageUrl(url, width)} ${width}w`).join(", ");
1921
1987
  }
1922
1988
  function $e8ffe11ed01df0fe$var$generateImageUrl(url, width) {
1923
- // This function is quite slow, we maybe could do string concat with encodeURIComponent instead if shopify handles double width params well?
1924
- url.searchParams.set("width", width);
1925
- return url.href;
1989
+ // Even just creating one `URL` object per image src and then setting the search parameter is quite slow (0.25ms to set the width param)
1990
+ // We're making the assumptions that the url has already at least one query parameter and that the image resizing service will choose the last one out of a duplicate width parameter (shopify's does)
1991
+ // That way we can just to string concatenation which is insanely fast
1992
+ return url + "&width=" + encodeURIComponent(width);
1926
1993
  }
1927
1994
  const $660070e2a394b3c3$var$backupSizeSignal = /*@__PURE__*/$i7OB2$createSignal();
1928
1995
  const $660070e2a394b3c3$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
@@ -1932,40 +1999,25 @@ function $660070e2a394b3c3$export$e4b984597b71e989(props) {
1932
1999
  // create a signal that's the same for all items in this listing
1933
2000
  context[$660070e2a394b3c3$export$d7b7ab832c20e2f4] = $i7OB2$createSignal();
1934
2001
  const [currentImageSize, setCurrentImageSize] = context?.[$660070e2a394b3c3$export$d7b7ab832c20e2f4] || $660070e2a394b3c3$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
1935
- const aspectRatiosSet = context ?
1936
- // If the context exists we have to create the set here as getting it here would be too late when it's created by ShopifyResponsiveImg below
1937
- context[(0, $e8ffe11ed01df0fe$export$f8945274f08a3105)] ||= new (0, $i7OB2$ListenableSet)() : undefined;
1938
- const [aspectRatios, setAspectRatios] = $i7OB2$createSignal(aspectRatiosSet, {
1939
- equals: false
1940
- });
1941
- const aspectRatioToUse = $i7OB2$createMemo(() => {
1942
- const aspectRatiosSet = aspectRatios(); // This signal "changes" to the same set every time the set changes, so we can use it as a dependency here
1943
- useMostPrevalentAspectRatio: {
1944
- if (!aspectRatiosSet || !props.autoAdjustAspectRatio) break useMostPrevalentAspectRatio;
1945
- // Get the aspect ratio that most of the loaded images inside the ListingProvider we are, load
1946
- const asArray = [...aspectRatiosSet].map(({
1947
- aspectRatio_: aspectRatio_
1948
- }) => aspectRatio_);
1949
- const mostPrevalentAspectRatio = $i7OB2$findMostFrequentItem(asArray);
1950
- if (mostPrevalentAspectRatio) return `var(${(0, $bb15dfb548a7666e$export$8a2234b5b1a5ebd4)}, ${mostPrevalentAspectRatio})`;
1951
- }
1952
- return props.aspectRatio;
1953
- });
1954
- const container = $i7OB2$createComponent((0, $f18d425032111270$export$94026ee33dbabc26), {
1955
- get aspectRatio() {
1956
- return aspectRatioToUse();
1957
- },
1958
- get ["class"]() {
2002
+ const [mostPrevalentAspectRatio] = context ?
2003
+ // If the context exists we have to create the signal here as getting it here would be too late when it's created by ShopifyResponsiveImg below
2004
+ context[(0, $e8ffe11ed01df0fe$export$6066eb417ed2e9f7)] ||= $i7OB2$createSignal() : [];
2005
+ const container = $f18d425032111270$export$94026ee33dbabc26({
2006
+ // Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
2007
+ get class() {
1959
2008
  return props.class;
2009
+ },
2010
+ get aspectRatio() {
2011
+ if (props.autoAdjustAspectRatio) {
2012
+ const targetRatio = mostPrevalentAspectRatio?.();
2013
+ if (targetRatio != undefined) return `var(${(0, $bb15dfb548a7666e$export$8a2234b5b1a5ebd4)}, ${targetRatio})`;
2014
+ }
2015
+ return props.aspectRatio;
1960
2016
  }
1961
2017
  });
1962
2018
  const owner = $i7OB2$getOwner();
1963
2019
  let createdSizeAccessor = false;
1964
2020
  let wasCleanedUp = false;
1965
- for (const event of ["add", "delete"]) {
1966
- aspectRatiosSet?.addEventListener(event, () => setAspectRatios(aspectRatiosSet));
1967
- $i7OB2$onCleanup(() => aspectRatiosSet?.removeEventListener(event, () => setAspectRatios(aspectRatiosSet)));
1968
- }
1969
2021
  $i7OB2$createEffect(() => {
1970
2022
  if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
1971
2023
  // ensure we always have a size accessor
@@ -2889,7 +2941,7 @@ const $024fbc0a2d796fad$var$TabsContext = /*@__PURE__*/$i7OB2$createContext();
2889
2941
  const $024fbc0a2d796fad$var$useTabs = () => $i7OB2$useContext($024fbc0a2d796fad$var$TabsContext);
2890
2942
  function $024fbc0a2d796fad$export$b2539bed5023c21c(props) {
2891
2943
  return $i7OB2$createComponent($024fbc0a2d796fad$var$TabsContext.Provider, {
2892
- value: new (0, $i7OB2$ListenableSet1)(),
2944
+ value: new (0, $i7OB2$ListenableSet)(),
2893
2945
  get children() {
2894
2946
  return $i7OB2$createComponent($024fbc0a2d796fad$var$ActualTabs, $i7OB2$mergeProps(props, {
2895
2947
  get children() {
@@ -10214,7 +10266,7 @@ function $49de9d31aeea1b5e$export$6d0c9c22f6652669({
10214
10266
  number_: num_results,
10215
10267
  i18n_: i18n_
10216
10268
  });
10217
- const queries_without_content_results_ = new (0, $i7OB2$ListenableSet)();
10269
+ const queries_without_content_results_ = new (0, $i7OB2$ListenableSet1)();
10218
10270
  const [check_query, set_check_query] = $i7OB2$createSignal(false);
10219
10271
  const placeholders_enabled = $i7OB2$createMemo(() => {
10220
10272
  // don't show placeholders when the user toggles filters
@@ -11660,4 +11712,4 @@ function $58b3487626e85ece$var$align_field_modal(alignmentSignals, input, modalV
11660
11712
  });
11661
11713
  }
11662
11714
  $i7OB2$add_to_version_info("ui", (0, $ec291e0010116877$export$83d89fbfd8236492));
11663
- export { $136f1d4d6c7ba6ac$export$e417c49320921907 as createDeparallelizedNoDropResource, $d8dbf52fea1773e2$export$f50b88e2a00918b5 as throw_globally, $42912431795f188e$export$9265e66f26f8e383 as ClassicSearchModal, $500a16dd18ee5a71$export$b0c55aa2e87c4be7 as SearchModalV2, $4f16612bea257571$export$9d4a4b669b1929ab as ModernResponsiveContainedImage, $024fbc0a2d796fad$export$3e41faf802a29e71 as Tab, $024fbc0a2d796fad$export$b2539bed5023c21c as Tabs, $8560c919ff763930$export$d4973c31938cbfd1 as ShopTheLookButton, $ca6f574bd8772184$export$e183a13865960371 as history_dot_state_to_state, $4147651646da990a$export$916e6850778505f6 as strip_encoded_filter_and_sort, $4147651646da990a$export$58aa3f171519b6d7 as encode_filters, $4147651646da990a$export$f934fa24c3a86811 as decode_filters, $4147651646da990a$export$62acb285a7579555 as encode_sorting, $4147651646da990a$export$766e9676e74997d3 as decode_sorting, $660070e2a394b3c3$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $011607bdf658f807$export$e68cff63f76bd15b as ListingProvider, $011607bdf658f807$export$8d0c4fdbb05a2f2e as useListing, $660070e2a394b3c3$export$e4b984597b71e989 as ShopifyContainedImage, $f32e14878e75af51$export$6649caad96ef8870 as SlidableItems, $2449872a62a75a20$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $ee116da074deb002$export$9574e176201e5e8d as RecommendationSlider, $9ea5383493360761$export$9756467d34d91cdb as RecommendationGrid, $e8ffe11ed01df0fe$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $e8ffe11ed01df0fe$export$e6fffe67d4cdd848 as makeSizeAccessor, $f18d425032111270$export$94026ee33dbabc26 as ImageContainer, $b7436a6d1fd64e3b$export$b69d0d92862de18b as SentryErrorBoundary, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d as ExpandingDetails, $c16e74cfe125bb05$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $1adfe60f3a14a1d7$export$fecbb157621501bd as SelectedFilters, $fab07f52c9861732$export$3f1a388cc0d8fed7 as FilterBody, $5efb5894079b220e$export$b288c38ae3fddb56 as create_modified_filters, $c8d5ff4524619fcd$export$d21e32dfedac04be as SolidLayout, $194bd6b8e4c59830$export$79b1565500412d9b as general_modal_abstraction, $19976a74d273070d$export$3b621d86b1566b2 as CrossIcon, $fbbadcb080ad1d4a$export$8be2714ec7f169ee as GenericSliderArrowButton, $a0f0e923bad68a9b$export$58e808b1db15d3bc as fetchDepictRecommendations, $961b5c64bef4662f$export$de035477d6fef996 as QuickLinks, $961b5c64bef4662f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a6e23a834336fc19$export$824dde41348efed1 as embedded_num_products, $4b2134398dfa83fa$export$c1a6b039e689a58e as get_listings, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $961b5c64bef4662f$export$e2bf8ce7779e827e as CategoryPage, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b6d5529b253681aa$export$3f238c96c45e6cc6 as ALIGN_TOP, $b6d5529b253681aa$export$902f8b4a7dae5d78 as ALIGN_WIDTH_ON_MODAL, $b6d5529b253681aa$export$7895aadd1956b1c7 as ALIGN_LEFT, $b6d5529b253681aa$export$6060bc6bee850eb6 as SET_CENTERED_LEFT, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $d20eff0aadc28983$export$acb3eaade4b23afd as BasePlaceholder, $d134eae24341b4a1$export$89c6019e4baa40b1 as TextPlaceholder, $7f60f09116a3fe61$export$3f37af283f8fb843 as ImagePlaceholder, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version, $58b3487626e85ece$export$316f6f283ae64765 as SearchField };
11715
+ export { $136f1d4d6c7ba6ac$export$e417c49320921907 as createDeparallelizedNoDropResource, $d8dbf52fea1773e2$export$f50b88e2a00918b5 as throw_globally, $42912431795f188e$export$9265e66f26f8e383 as ClassicSearchModal, $500a16dd18ee5a71$export$b0c55aa2e87c4be7 as SearchModalV2, $4f16612bea257571$export$9d4a4b669b1929ab as ModernResponsiveContainedImage, $024fbc0a2d796fad$export$3e41faf802a29e71 as Tab, $024fbc0a2d796fad$export$b2539bed5023c21c as Tabs, $8560c919ff763930$export$d4973c31938cbfd1 as ShopTheLookButton, $ca6f574bd8772184$export$e183a13865960371 as history_dot_state_to_state, $4147651646da990a$export$916e6850778505f6 as strip_encoded_filter_and_sort, $4147651646da990a$export$58aa3f171519b6d7 as encode_filters, $4147651646da990a$export$f934fa24c3a86811 as decode_filters, $4147651646da990a$export$62acb285a7579555 as encode_sorting, $4147651646da990a$export$766e9676e74997d3 as decode_sorting, $660070e2a394b3c3$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $011607bdf658f807$export$e68cff63f76bd15b as ListingProvider, $011607bdf658f807$export$8d0c4fdbb05a2f2e as useListing, $b6440e72ed83671a$export$11354f017ddc9790 as ProductCardIndexProvider, $b6440e72ed83671a$export$e3faf4d95300054f as useProductCardIndex, $660070e2a394b3c3$export$e4b984597b71e989 as ShopifyContainedImage, $f32e14878e75af51$export$6649caad96ef8870 as SlidableItems, $2449872a62a75a20$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $ee116da074deb002$export$9574e176201e5e8d as RecommendationSlider, $9ea5383493360761$export$9756467d34d91cdb as RecommendationGrid, $e8ffe11ed01df0fe$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $e8ffe11ed01df0fe$export$e6fffe67d4cdd848 as makeSizeAccessor, $f18d425032111270$export$94026ee33dbabc26 as ImageContainer, $b7436a6d1fd64e3b$export$b69d0d92862de18b as SentryErrorBoundary, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d as ExpandingDetails, $c16e74cfe125bb05$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $1adfe60f3a14a1d7$export$fecbb157621501bd as SelectedFilters, $fab07f52c9861732$export$3f1a388cc0d8fed7 as FilterBody, $5efb5894079b220e$export$b288c38ae3fddb56 as create_modified_filters, $c8d5ff4524619fcd$export$d21e32dfedac04be as SolidLayout, $194bd6b8e4c59830$export$79b1565500412d9b as general_modal_abstraction, $19976a74d273070d$export$3b621d86b1566b2 as CrossIcon, $fbbadcb080ad1d4a$export$8be2714ec7f169ee as GenericSliderArrowButton, $a0f0e923bad68a9b$export$58e808b1db15d3bc as fetchDepictRecommendations, $961b5c64bef4662f$export$de035477d6fef996 as QuickLinks, $961b5c64bef4662f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a6e23a834336fc19$export$824dde41348efed1 as embedded_num_products, $4b2134398dfa83fa$export$c1a6b039e689a58e as get_listings, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $961b5c64bef4662f$export$e2bf8ce7779e827e as CategoryPage, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b6d5529b253681aa$export$3f238c96c45e6cc6 as ALIGN_TOP, $b6d5529b253681aa$export$902f8b4a7dae5d78 as ALIGN_WIDTH_ON_MODAL, $b6d5529b253681aa$export$7895aadd1956b1c7 as ALIGN_LEFT, $b6d5529b253681aa$export$6060bc6bee850eb6 as SET_CENTERED_LEFT, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $d20eff0aadc28983$export$acb3eaade4b23afd as BasePlaceholder, $d134eae24341b4a1$export$89c6019e4baa40b1 as TextPlaceholder, $7f60f09116a3fe61$export$3f37af283f8fb843 as ImagePlaceholder, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version, $58b3487626e85ece$export$316f6f283ae64765 as SearchField };