@depict-ai/ui 2.1.4 → 2.1.6

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.
@@ -1,6 +1,6 @@
1
- import { add_to_version_info as $b8hua$add_to_version_info, base64_encode_unicode as $b8hua$base64_encode_unicode, base64_decode_unicode as $b8hua$base64_decode_unicode, dlog as $b8hua$dlog, queueMacroTask as $b8hua$queueMacroTask, catchify as $b8hua$catchify, is_safari as $b8hua$is_safari, observer as $b8hua$observer, Amazing_Slider as $b8hua$Amazing_Slider, slider_snap_css as $b8hua$slider_snap_css, slider_fading_factory as $b8hua$slider_fading_factory, slider_fractional_factory as $b8hua$slider_fractional_factory, camelCasifyObject as $b8hua$camelCasifyObject, make_random_classname as $b8hua$make_random_classname, n_col_styling_with_dist as $b8hua$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $b8hua$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $b8hua$layout_get_total_rec_amount_for_row, layout_media_query_header as $b8hua$layout_media_query_header, report as $b8hua$report, useExpandingContainer as $b8hua$useExpandingContainer, standard_price_format as $b8hua$standard_price_format, hex_to_rgb as $b8hua$hex_to_rgb, relative_luminance_from_rgb as $b8hua$relative_luminance_from_rgb, fetch_recs as $b8hua$fetch_recs, snakeCasifyObject as $b8hua$snakeCasifyObject, instant_exec_on_suspect_history_change as $b8hua$instant_exec_on_suspect_history_change, base_url as $b8hua$base_url, get_depict_id as $b8hua$get_depict_id, get_user_id as $b8hua$get_user_id, get_session_id as $b8hua$get_session_id, make_url_with_query_params as $b8hua$make_url_with_query_params, fetch_retry as $b8hua$fetch_retry, add_version_query_params as $b8hua$add_version_query_params, dwarn as $b8hua$dwarn, sort_obj as $b8hua$sort_obj, edit_current_page_meta_tags as $b8hua$edit_current_page_meta_tags, javascript_media_query as $b8hua$javascript_media_query, use_href_accessor as $b8hua$use_href_accessor, make_asyncIterable_exiter as $b8hua$make_asyncIterable_exiter, href_change_ipns as $b8hua$href_change_ipns, ContainedImage as $b8hua$ContainedImage, deparallelize_no_drop as $b8hua$deparallelize_no_drop, ListenableSet as $b8hua$ListenableSet, insert_surfaces as $b8hua$insert_surfaces } from "@depict-ai/utilishared/ES10";
2
- import { createComponent as $b8hua$createComponent, ssr as $b8hua$ssr, ssrHydrationKey as $b8hua$ssrHydrationKey, ssrStyle as $b8hua$ssrStyle, ssrElement as $b8hua$ssrElement, mergeProps as $b8hua$mergeProps, escape as $b8hua$escape, insert as $b8hua$insert, ssrAttribute as $b8hua$ssrAttribute, isServer as $b8hua$isServer, ssrClassList as $b8hua$ssrClassList, Dynamic as $b8hua$Dynamic } from "solid-js/web";
3
- import { createSignal as $b8hua$createSignal, getOwner as $b8hua$getOwner, createEffect as $b8hua$createEffect, runWithOwner as $b8hua$runWithOwner, onCleanup as $b8hua$onCleanup, createMemo as $b8hua$createMemo, createContext as $b8hua$createContext, useContext as $b8hua$useContext, createResource as $b8hua$createResource, Suspense as $b8hua$Suspense, Show as $b8hua$Show, untrack as $b8hua$untrack, createRenderEffect as $b8hua$createRenderEffect, Index as $b8hua$Index, createRoot as $b8hua$createRoot, For as $b8hua$For, createUniqueId as $b8hua$createUniqueId, createComputed as $b8hua$createComputed, ErrorBoundary as $b8hua$ErrorBoundary, on as $b8hua$on, batch as $b8hua$batch, createReaction as $b8hua$createReaction, mapArray as $b8hua$mapArray, mergeProps as $b8hua$mergeProps1 } from "solid-js";
1
+ import { add_to_version_info as $b8hua$add_to_version_info, base64_encode_unicode as $b8hua$base64_encode_unicode, base64_decode_unicode as $b8hua$base64_decode_unicode, dlog as $b8hua$dlog, queueMacroTask as $b8hua$queueMacroTask, catchify as $b8hua$catchify, is_safari as $b8hua$is_safari, observer as $b8hua$observer, dwarn as $b8hua$dwarn, Amazing_Slider as $b8hua$Amazing_Slider, slider_snap_css as $b8hua$slider_snap_css, slider_fading_factory as $b8hua$slider_fading_factory, slider_fractional_factory as $b8hua$slider_fractional_factory, camelCasifyObject as $b8hua$camelCasifyObject, make_random_classname as $b8hua$make_random_classname, n_col_styling_with_dist as $b8hua$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $b8hua$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $b8hua$layout_get_total_rec_amount_for_row, layout_media_query_header as $b8hua$layout_media_query_header, report as $b8hua$report, useExpandingContainer as $b8hua$useExpandingContainer, standard_price_format as $b8hua$standard_price_format, hex_to_rgb as $b8hua$hex_to_rgb, relative_luminance_from_rgb as $b8hua$relative_luminance_from_rgb, fetch_recs as $b8hua$fetch_recs, snakeCasifyObject as $b8hua$snakeCasifyObject, instant_exec_on_suspect_history_change as $b8hua$instant_exec_on_suspect_history_change, base_url as $b8hua$base_url, get_depict_id as $b8hua$get_depict_id, get_user_id as $b8hua$get_user_id, get_session_id as $b8hua$get_session_id, make_url_with_query_params as $b8hua$make_url_with_query_params, fetch_retry as $b8hua$fetch_retry, add_version_query_params as $b8hua$add_version_query_params, sort_obj as $b8hua$sort_obj, edit_current_page_meta_tags as $b8hua$edit_current_page_meta_tags, javascript_media_query as $b8hua$javascript_media_query, use_href_accessor as $b8hua$use_href_accessor, make_asyncIterable_exiter as $b8hua$make_asyncIterable_exiter, href_change_ipns as $b8hua$href_change_ipns, ContainedImage as $b8hua$ContainedImage, deparallelize_no_drop as $b8hua$deparallelize_no_drop, ListenableSet as $b8hua$ListenableSet, insert_surfaces as $b8hua$insert_surfaces } from "@depict-ai/utilishared/ES10";
2
+ import { createComponent as $b8hua$createComponent, insert as $b8hua$insert, ssr as $b8hua$ssr, ssrHydrationKey as $b8hua$ssrHydrationKey, ssrStyle as $b8hua$ssrStyle, spread as $b8hua$spread, escape as $b8hua$escape, ssrAttribute as $b8hua$ssrAttribute, mergeProps as $b8hua$mergeProps1, isServer as $b8hua$isServer, ssrElement as $b8hua$ssrElement, ssrClassList as $b8hua$ssrClassList, Dynamic as $b8hua$Dynamic } from "solid-js/web";
3
+ import { createSignal as $b8hua$createSignal, getOwner as $b8hua$getOwner, createEffect as $b8hua$createEffect, runWithOwner as $b8hua$runWithOwner, onCleanup as $b8hua$onCleanup, createMemo as $b8hua$createMemo, createContext as $b8hua$createContext, useContext as $b8hua$useContext, mergeProps as $b8hua$mergeProps, Show as $b8hua$Show, createResource as $b8hua$createResource, Suspense as $b8hua$Suspense, untrack as $b8hua$untrack, createRenderEffect as $b8hua$createRenderEffect, Index as $b8hua$Index, createRoot as $b8hua$createRoot, For as $b8hua$For, createUniqueId as $b8hua$createUniqueId, createComputed as $b8hua$createComputed, ErrorBoundary as $b8hua$ErrorBoundary, on as $b8hua$on, batch as $b8hua$batch, createReaction as $b8hua$createReaction, mapArray as $b8hua$mapArray } from "solid-js";
4
4
  import $b8hua$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
5
5
  import $b8hua$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
6
6
  import $b8hua$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
@@ -9,7 +9,7 @@ import { createStore as $b8hua$createStore, reconcile as $b8hua$reconcile } from
9
9
  /*! Depict.ai search and product listing SDK */
10
10
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
11
11
  register_es_version("ui", "ES10");
12
- const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.4";
12
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.6";
13
13
  const $2855bffe06ef7a03$var$fallback_operator = "in";
14
14
  const $2855bffe06ef7a03$var$fallback_token = "";
15
15
  const $2855bffe06ef7a03$var$legacy_filter_prefix = "filter_";
@@ -232,6 +232,7 @@ function $56047603f9d212b6$export$e6fffe67d4cdd848(whatToWatch) {
232
232
  });
233
233
  return size;
234
234
  }
235
+ const $56047603f9d212b6$var$onIdleFunctionsSymbol = /*@__PURE__*/Symbol("onIdleFunctions");
235
236
  function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
236
237
  // Enable reactive props
237
238
  const otherOptions = $b8hua$createMemo(() => {
@@ -254,11 +255,95 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
254
255
  srcset: srcset
255
256
  };
256
257
  });
257
- return $b8hua$ssrElement("img", $b8hua$mergeProps(otherOptions, src_options, {
258
- get sizes() {
259
- return props.size() + "px";
260
- }
261
- }), undefined, true);
258
+ // Work around https://github.com/solidjs/solid/issues/1828
259
+ const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
260
+ const [hasSetSize, setHasSetSize] = $b8hua$createSignal(false);
261
+ const [hasDecoded, setHasDecoded] = $b8hua$createSignal(false);
262
+ const sizePX = $b8hua$createMemo(() => "".concat(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
263
+ const listingContext = $5441862cd2f5e111$export$8d0c4fdbb05a2f2e();
264
+ // 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
265
+ // Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
266
+ const executeWhenIdleBatched = fn => {
267
+ if (typeof requestIdleCallback !== "function") setTimeout(fn); // Old browsers don't get optimisation
268
+ const existingStack = listingContext === null || listingContext === void 0 ? void 0 : listingContext[$56047603f9d212b6$var$onIdleFunctionsSymbol];
269
+ if (existingStack) return existingStack.add(fn);
270
+ const newStack = new Set([fn]);
271
+ if (listingContext) listingContext[$56047603f9d212b6$var$onIdleFunctionsSymbol] = newStack;
272
+ const processStackWhenIdle = () => requestIdleCallback(deadline => {
273
+ const start = performance.now();
274
+ const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
275
+ for (const fn of newStack) {
276
+ newStack.delete(fn);
277
+ fn();
278
+ const timeTaken = performance.now() - start;
279
+ if ((!deadline.timeRemaining() || timeTaken > thirdDeadlineTime) && newStack.size) {
280
+ // There's still work to be done but no time, so schedule another idle callback
281
+ processStackWhenIdle();
282
+ return;
283
+ }
284
+ }
285
+ // Stack is empty
286
+ if (listingContext) delete listingContext[$56047603f9d212b6$var$onIdleFunctionsSymbol];
287
+ }, {
288
+ timeout: 15000
289
+ } // 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
290
+ );
291
+
292
+ processStackWhenIdle();
293
+ };
294
+ let sizeSetFastPath = false;
295
+ let hasDecodedFastPath = false;
296
+ let timeoutSet = false;
297
+ let gotCleanedUp = false;
298
+ $b8hua$onCleanup(() => gotCleanedUp = true);
299
+ $b8hua$spread(img, $b8hua$mergeProps(otherOptions), false, true);
300
+ $b8hua$createEffect(() => {
301
+ if (!props.size()) return; // wait until we have a size
302
+ if (timeoutSet) return;
303
+ const handler = $b8hua$catchify(() => {
304
+ if (gotCleanedUp) return;
305
+ img.sizes = sizePX(); // use latest available value of props.size
306
+ if (!sizeSetFastPath) {
307
+ setHasSetSize(true);
308
+ sizeSetFastPath = true;
309
+ }
310
+ timeoutSet = false;
311
+ });
312
+ // Throttle the updating of sizes to avoid unnecessary image re-fetches during resize
313
+ // And also because we first set src after sizes has been set, wait with loading and decoding images until browser is idle
314
+ // This greatly improves performance when loading (more) products
315
+ // See https://depictaiworkspace.slack.com/archives/C05NJ0K3WRL/p1698220617663139
316
+ executeWhenIdleBatched(handler);
317
+ timeoutSet = true;
318
+ });
319
+ $b8hua$createEffect(() => {
320
+ 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
321
+ Object.assign(img, src_options());
322
+ // Add to DOM once decoded to not require/block any paints before image has completed loading and avoid showing broken image symbol
323
+ // We can do this because there has to be a container around us giving us a size
324
+ // No need to listen if we're already in the DOM
325
+ if (hasDecodedFastPath) return;
326
+ if (props.loading === "lazy") {
327
+ // For lazy loading there's no decoding to wait for as it only occurs when the image is visible
328
+ // Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
329
+ setHasDecoded(true);
330
+ hasDecodedFastPath = true;
331
+ }
332
+ img.decode().catch(e => $b8hua$dwarn("Failed to decode image", e, img)) // Display the image also if loading failed so webdev can debug and doesn't get "no image"
333
+ .then(async () => {
334
+ // Also wait with inserting image (i.e. paint) until browser is idle
335
+ await new Promise(r => executeWhenIdleBatched(r));
336
+ if (gotCleanedUp) return;
337
+ setHasDecoded(true);
338
+ hasDecodedFastPath = true;
339
+ });
340
+ });
341
+ return $b8hua$createComponent((0, $b8hua$Show), {
342
+ get when() {
343
+ return hasDecoded();
344
+ },
345
+ children: img
346
+ });
262
347
  }
263
348
  function $56047603f9d212b6$var$make_srcset(url, resolutions) {
264
349
  return resolutions.map(width => "".concat($56047603f9d212b6$var$generateImageUrl(url, width), " ").concat(width, "w")).join(", ");
@@ -296,7 +381,7 @@ function $4df489344a0f97c7$export$e4b984597b71e989(props) {
296
381
  $b8hua$queueMacroTask(() => setCurrentImageSize(undefined)); // unset the size accessor next event loop iteration, so that all onCleanup's have time to run, since the effects run more aggressively and can create a size accessor with a cleaned up owner otherwise
297
382
  });
298
383
 
299
- container.append($b8hua$createComponent((0, $56047603f9d212b6$export$6e5611bc7e57e477), {
384
+ $b8hua$insert(container, $b8hua$createComponent((0, $56047603f9d212b6$export$6e5611bc7e57e477), {
300
385
  style: "width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0;",
301
386
  get size() {
302
387
  return $b8hua$createMemo(() => {
@@ -700,7 +785,7 @@ const $63f1f8dbcd07d3b0$var$_tmpl$ = ["<div", ' class="', '">', "</div>"],
700
785
  $63f1f8dbcd07d3b0$var$_tmpl$2 = ["<style", ' type="text/css">', "</style>"];
701
786
  function $63f1f8dbcd07d3b0$export$d21e32dfedac04be(props) {
702
787
  const container_class = "x" + $b8hua$createUniqueId();
703
- const container_element_ = $b8hua$ssrElement("div", $b8hua$mergeProps(() => props.element_attributes, {
788
+ const container_element_ = $b8hua$ssrElement("div", $b8hua$mergeProps1(() => props.element_attributes, {
704
789
  classList: {
705
790
  [container_class]: true
706
791
  }
@@ -834,7 +919,7 @@ function $39ddb986053fb759$export$d41d19e89346fa2(_ref) {
834
919
  } = slider;
835
920
  const Layout = props => $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, insert_here, true);
836
921
  // Do like this, so we don't have to call mergeProps ourselves
837
- $b8hua$createComponent(Layout, $b8hua$mergeProps({
922
+ $b8hua$createComponent(Layout, $b8hua$mergeProps1({
838
923
  rows: "all",
839
924
  layout: "slider"
840
925
  }, layout_options_));
@@ -956,7 +1041,7 @@ function $e3efeb558d952696$export$7da560f849543dff(_ref) {
956
1041
  return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
957
1042
  });
958
1043
  const num_placeholders_ = () => 20;
959
- const elements = $b8hua$ssr($e3efeb558d952696$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape($ca55612a53dbbdd2$export$a2cc176055f8f08()), $b8hua$escape($b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $b8hua$mergeProps({
1044
+ const elements = $b8hua$ssr($e3efeb558d952696$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape($ca55612a53dbbdd2$export$a2cc176055f8f08()), $b8hua$escape($b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $b8hua$mergeProps1({
960
1045
  get rows() {
961
1046
  return rows_object_();
962
1047
  },
@@ -1171,7 +1256,7 @@ function $60ec7a29849d81db$export$a71e92cfbb498adc(props) {
1171
1256
  const $9783d437ad61594c$var$_tmpl$ = '<path d="M11.669 10.531l9.156-9.156a.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569A.8.8 0 0 0 20.24 0a.77.77 0 0 0-.569.237l-9.14 9.14-9.14-9.14A.79.79 0 0 0 .807 0a.77.77 0 0 0-.569.237A.78.78 0 0 0 0 .807a.77.77 0 0 0 .237.569l9.156 9.156-9.156 9.14c-.159.157-.237.349-.237.569s.079.412.237.569c.085.085.174.148.268.19a1.095 1.095 0 0 0 .316.048.894.894 0 0 0 .285-.048.84.84 0 0 0 .285-.19l9.139-9.14 9.14 9.14a.894.894 0 0 0 .268.19 1.049 1.049 0 0 0 .301.048.941.941 0 0 0 .301-.048.84.84 0 0 0 .285-.19.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569z"></path>';
1172
1257
  function $9783d437ad61594c$export$3b621d86b1566b2() {
1173
1258
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1174
- return $b8hua$ssrElement("svg", $b8hua$mergeProps(props, {
1259
+ return $b8hua$ssrElement("svg", $b8hua$mergeProps1(props, {
1175
1260
  xmlns: "http://www.w3.org/2000/svg",
1176
1261
  width: "21.064",
1177
1262
  height: "21.047",
@@ -1423,7 +1508,7 @@ const $19e828709c7723a0$export$48513f6b9f8ce62d = props => {
1423
1508
  };
1424
1509
  const $ff3225aef892a467$var$_tmpl$ = '<path d="M10.173 5.548H5.5V.875c0-.075-.027-.14-.081-.193S5.301.601 5.226.601s-.14.027-.193.081-.081.118-.081.193v4.673H.274c-.075 0-.14.027-.193.081A.27.27 0 0 0 0 5.827c0 .075.027.14.081.193s.118.081.193.081h4.678v4.673c0 .075.027.14.081.193s.118.081.193.081.14-.027.193-.081.081-.118.081-.193V6.101h4.673a.27.27 0 0 0 .199-.081c.054-.054.08-.118.08-.193a.27.27 0 0 0-.279-.279z" fill="#000"></path>';
1425
1510
  function $ff3225aef892a467$export$f21ab0717a89c77f(props) {
1426
- return $b8hua$ssrElement("svg", $b8hua$mergeProps(props, {
1511
+ return $b8hua$ssrElement("svg", $b8hua$mergeProps1(props, {
1427
1512
  xmlns: "http://www.w3.org/2000/svg",
1428
1513
  width: "11",
1429
1514
  height: "12"
@@ -2349,7 +2434,7 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
2349
2434
  const current_value = $af5d8e0b7d97a7f6$export$325f75597868c4f0(value().value_);
2350
2435
  return !!(data !== null && data !== void 0 && data.some(item => $af5d8e0b7d97a7f6$export$325f75597868c4f0(item) === current_value));
2351
2436
  });
2352
- const MakeButton = attributes => $b8hua$ssrElement("button", $b8hua$mergeProps(attributes, {
2437
+ const MakeButton = attributes => $b8hua$ssrElement("button", $b8hua$mergeProps1(attributes, {
2353
2438
  get disabled() {
2354
2439
  return value().count_ === 0 && !is_selected();
2355
2440
  },
@@ -2613,7 +2698,7 @@ var $d2988f745661df9c$export$2e2bcd8739ae039 = {
2613
2698
  const $905f44be08b7378e$var$_tmpl$ = '<path d="M4.617 12.738a.48.48 0 0 1-.164-.027c-.051-.023-.094-.055-.129-.098L.125 8.414A.39.39 0 0 1 0 8.117c0-.113.039-.211.125-.293s.18-.125.293-.125.215.043.297.125l3.902 3.902L16.086.262c.082-.082.18-.125.297-.125s.211.043.293.125.125.184.125.301-.043.215-.125.297L4.914 12.613c-.039.043-.086.078-.141.098s-.102.027-.156.027zm0 0"></path>';
2614
2699
  function $905f44be08b7378e$export$f2ca6fc699ca1fb4() {
2615
2700
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2616
- return $b8hua$ssrElement("svg", $b8hua$mergeProps({
2701
+ return $b8hua$ssrElement("svg", $b8hua$mergeProps1({
2617
2702
  xmlns: "http://www.w3.org/2000/svg",
2618
2703
  width: "16.8",
2619
2704
  height: "14"
@@ -4067,7 +4152,7 @@ const $64d94dcaa058dc7b$var$_tmpl$ = ["<style", ' type="text/css">', "</style>"]
4067
4152
  const $64d94dcaa058dc7b$export$c500183c31c2b22e = "--spans-columns";
4068
4153
  function $64d94dcaa058dc7b$export$ab6b147eec64fea5(props) {
4069
4154
  const container_class = "x" + $b8hua$createUniqueId();
4070
- const container_element_ = $b8hua$ssrElement("div", $b8hua$mergeProps(() => props.element_attributes, {
4155
+ const container_element_ = $b8hua$ssrElement("div", $b8hua$mergeProps1(() => props.element_attributes, {
4071
4156
  classList: {
4072
4157
  [container_class]: true
4073
4158
  }
@@ -4368,7 +4453,7 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
4368
4453
  })));
4369
4454
  }
4370
4455
  });
4371
- return $b8hua$mergeProps1(block, {
4456
+ return $b8hua$mergeProps(block, {
4372
4457
  // Create content divs for the blocks with as much fine-grained diffing as possible?
4373
4458
  content: () => {
4374
4459
  // Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
@@ -4726,7 +4811,7 @@ const $79af35736fe8e5c8$var$_tmpl$ = '<path d="M6.199 10.254a.35.35 0 0 0-.496 0
4726
4811
  $79af35736fe8e5c8$var$_tmpl$2 = '<path d="M10.852 6.301H8.051a.35.35 0 0 1-.352-.352V4.551a.35.35 0 0 1 .352-.352h2.801a.35.35 0 0 1 .348.352v1.398a.35.35 0 0 1-.348.352zm-2.453-.699H10.5v-.703H8.398zm3.851 3.5H8.051c-.195 0-.352-.16-.352-.352V7.352A.35.35 0 0 1 8.051 7h4.199c.191 0 .352.156.352.352V8.75c0 .191-.16.352-.352.352zm-3.852-.703h3.5V7.7h-3.5zm5.25 3.499H8.051a.35.35 0 0 1-.352-.348v-1.402a.35.35 0 0 1 .352-.348h5.598a.35.35 0 0 1 .352.348v1.402a.35.35 0 0 1-.352.348zm-5.25-.699H13.3V10.5H8.398zm0 0"></path>';
4727
4812
  function $79af35736fe8e5c8$export$da32f7add8a22e86() {
4728
4813
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4729
- return $b8hua$ssrElement("svg", $b8hua$mergeProps({
4814
+ return $b8hua$ssrElement("svg", $b8hua$mergeProps1({
4730
4815
  xmlns: "http://www.w3.org/2000/svg",
4731
4816
  width: "14",
4732
4817
  height: "14",
@@ -4736,7 +4821,7 @@ function $79af35736fe8e5c8$export$da32f7add8a22e86() {
4736
4821
  const $73e3c96bc365e0e9$var$_tmpl$ = '<path d="M6.199 10.254a.35.35 0 0 0-.496 0L3.5 12.453V.348a.35.35 0 0 0-.7 0v12.105L.598 10.254c-.137-.137-.359-.137-.492 0a.35.35 0 0 0 0 .492l2.797 2.801a.35.35 0 0 0 .496 0L6.2 10.746c.137-.137.137-.355 0-.492zm3.25 1.644H8.051a.35.35 0 0 1-.352-.348v-1.402a.35.35 0 0 1 .352-.348h1.398a.35.35 0 0 1 .352.348v1.402a.35.35 0 0 1-.352.348zm-1.051-.699h.703V10.5h-.703zm2.454-2.097H8.051c-.195 0-.352-.16-.352-.352V7.352A.35.35 0 0 1 8.051 7h2.801a.35.35 0 0 1 .348.352V8.75c0 .191-.156.352-.348.352zm-2.453-.703H10.5V7.7H8.398zm3.851-2.098H8.051a.35.35 0 0 1-.352-.352V4.551a.35.35 0 0 1 .352-.352h4.199c.191 0 .352.156.352.352v1.398c0 .195-.16.352-.352.352zm-3.852-.699h3.5v-.703h-3.5zm5.25-2.102H8.051a.35.35 0 0 1-.352-.352V1.75c0-.191.156-.352.352-.352h5.598c.195 0 .352.16.352.352v1.398a.35.35 0 0 1-.352.352zm-5.25-.699H13.3v-.699H8.398zm0 0"></path>';
4737
4822
  function $73e3c96bc365e0e9$export$d10e63059ddb9fd4() {
4738
4823
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4739
- return $b8hua$ssrElement("svg", $b8hua$mergeProps({
4824
+ return $b8hua$ssrElement("svg", $b8hua$mergeProps1({
4740
4825
  xmlns: "http://www.w3.org/2000/svg",
4741
4826
  width: "14",
4742
4827
  height: "14",
@@ -4852,7 +4937,7 @@ function $082c4ed3e22f8d71$export$9bf11afa910f536e(_ref) {
4852
4937
  })));
4853
4938
  },
4854
4939
  get children() {
4855
- return $b8hua$ssr($082c4ed3e22f8d71$var$_tmpl$5, $b8hua$ssrHydrationKey(), $b8hua$escape($b8hua$createComponent((0, $f6b0500577e1b210$export$3f1a388cc0d8fed7), $b8hua$mergeProps(args_for_filtering_, {
4940
+ return $b8hua$ssr($082c4ed3e22f8d71$var$_tmpl$5, $b8hua$ssrHydrationKey(), $b8hua$escape($b8hua$createComponent((0, $f6b0500577e1b210$export$3f1a388cc0d8fed7), $b8hua$mergeProps1(args_for_filtering_, {
4856
4941
  are_in_modal_: true
4857
4942
  }))));
4858
4943
  }
@@ -7039,7 +7124,7 @@ function $ecc323d9c29305ee$export$1c641004b5485fed() {
7039
7124
  const $ef0f18a578b32578$var$_tmpl$ = '<path d="M19.811 20.174l-6.234-6.809a7.96 7.96 0 0 0 .923-1.179c.274-.424.502-.865.687-1.323a8.04 8.04 0 0 0 .42-1.436 7.88 7.88 0 0 0 .144-1.507c0-.526-.051-1.042-.154-1.548-.096-.506-.243-.995-.441-1.466s-.441-.919-.728-1.343a8.28 8.28 0 0 0-.984-1.21 7.86 7.86 0 0 0-1.2-.984A7.56 7.56 0 0 0 10.89.651C10.418.453 9.929.302 9.423.2S8.401.046 7.875.046 6.833.097 6.327.2 5.332.453 4.86.651a7.56 7.56 0 0 0-1.354.718c-.431.287-.831.615-1.2.984a8.28 8.28 0 0 0-.984 1.21 7.73 7.73 0 0 0-.728 1.343c-.198.472-.349.96-.451 1.466A8.31 8.31 0 0 0 0 7.921a8.31 8.31 0 0 0 .144 1.548c.103.506.253.995.451 1.466a8.08 8.08 0 0 0 .728 1.354 7.86 7.86 0 0 0 .984 1.2 7.54 7.54 0 0 0 1.2.995c.431.287.882.53 1.354.728.472.191.96.338 1.466.441a8.31 8.31 0 0 0 1.548.144c.451 0 .896-.038 1.333-.113a7.83 7.83 0 0 0 1.282-.328 7.55 7.55 0 0 0 1.2-.533 8.08 8.08 0 0 0 1.107-.749l6.245 6.809a.45.45 0 0 0 .174.123.55.55 0 0 0 .205.041.61.61 0 0 0 .195-.031c.061-.021.116-.055.164-.102.109-.096.164-.219.164-.369.007-.144-.038-.267-.133-.369zM1.046 7.921c0-.937.178-1.818.533-2.646.362-.834.851-1.559 1.466-2.174.622-.615 1.347-1.101 2.174-1.456.827-.362 1.712-.543 2.656-.543s1.829.181 2.656.543c.827.355 1.548.841 2.164 1.456.622.615 1.111 1.34 1.466 2.174a6.52 6.52 0 0 1 .543 2.646c0 .943-.181 1.829-.543 2.656a6.89 6.89 0 0 1-1.466 2.174c-.615.615-1.336 1.104-2.164 1.466-.827.356-1.712.533-2.656.533s-1.829-.178-2.656-.533c-.827-.362-1.552-.851-2.174-1.466-.615-.622-1.104-1.347-1.466-2.174-.355-.827-.533-1.712-.533-2.656z"></path>';
7040
7125
  function $ef0f18a578b32578$export$82eafebb825fc23f() {
7041
7126
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7042
- return $b8hua$ssrElement("svg", $b8hua$mergeProps(props, {
7127
+ return $b8hua$ssrElement("svg", $b8hua$mergeProps1(props, {
7043
7128
  xmlns: "http://www.w3.org/2000/svg",
7044
7129
  width: "20",
7045
7130
  height: "22"
@@ -7106,7 +7191,7 @@ function $8ef6232475d44150$export$7de92c4c2205ebf3(_ref) {
7106
7191
  return per_column;
7107
7192
  })));
7108
7193
  // Don't tear down elements every time one updates the page - don't put them within <Show>
7109
- const elements = $b8hua$ssr($8ef6232475d44150$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape(i18n_.search_recs_title_()), $b8hua$escape($ca55612a53dbbdd2$export$a2cc176055f8f08()), $b8hua$escape($b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $b8hua$mergeProps({
7194
+ const elements = $b8hua$ssr($8ef6232475d44150$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape(i18n_.search_recs_title_()), $b8hua$escape($ca55612a53dbbdd2$export$a2cc176055f8f08()), $b8hua$escape($b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $b8hua$mergeProps1({
7110
7195
  rows: rows_object,
7111
7196
  layout: "grid",
7112
7197
  element_attributes: {
@@ -7612,7 +7697,7 @@ function $02b6641aa50ce528$export$ba17c5b7e6dda39f(_ref) {
7612
7697
  const $3c5e15c6ee4227a9$var$_tmpl$ = '<path d="M56 26.455a13.71 13.71 0 0 0-9.578 3.967A13.71 13.71 0 0 0 42.455 40v176a13.71 13.71 0 0 0 3.967 9.578A13.71 13.71 0 0 0 56 229.545h144A13.71 13.71 0 0 0 213.545 216V88a2.456 2.456 0 0 1 0-.002c.001-1.452-.597-2.895-1.623-3.922l-55.998-55.998a5.61 5.61 0 0 0-3.922-1.623 2.456 2.456 0 0 1-.002 0zm0 11.09h88A2.456 2.456 0 0 1 146.455 40v48c0 2.903 2.642 5.545 5.545 5.545h48A2.456 2.456 0 0 1 202.455 96v120a2.456 2.456 0 0 1-2.455 2.455H56A2.456 2.456 0 0 1 53.545 216V40A2.456 2.456 0 0 1 56 37.545zm103.061 11.498a2.456 2.456 0 0 1 2.676.531l28.689 28.689a2.456 2.456 0 0 1-1.736 4.191H160A2.456 2.456 0 0 1 157.545 80V51.311a2.456 2.456 0 0 1 1.516-2.268zM96 130.455c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545zm0 32c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545z"></path>';
7613
7698
  function $3c5e15c6ee4227a9$export$605674723bcc715c() {
7614
7699
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7615
- return $b8hua$ssrElement("svg", $b8hua$mergeProps({
7700
+ return $b8hua$ssrElement("svg", $b8hua$mergeProps1({
7616
7701
  xmlns: "http://www.w3.org/2000/svg",
7617
7702
  width: "32",
7618
7703
  height: "32",
@@ -8750,7 +8835,7 @@ function $22470de5f42cc35d$export$f631859cab12b342(_ref) {
8750
8835
  if (content_result_) return $b8hua$ssrElement("a", attributes, () => $b8hua$escape(children), true);
8751
8836
  return $b8hua$ssrElement("div", attributes, () => $b8hua$escape(children), true);
8752
8837
  };
8753
- return $b8hua$ssr($22470de5f42cc35d$var$_tmpl$2, $b8hua$ssrHydrationKey(), $b8hua$escape($b8hua$createComponent(LinkIfPossible, $b8hua$mergeProps(make_link_attributes, {
8838
+ return $b8hua$ssr($22470de5f42cc35d$var$_tmpl$2, $b8hua$ssrHydrationKey(), $b8hua$escape($b8hua$createComponent(LinkIfPossible, $b8hua$mergeProps1(make_link_attributes, {
8754
8839
  tabIndex: "-1",
8755
8840
  get children() {
8756
8841
  return $b8hua$createComponent((0, $3c5e15c6ee4227a9$export$605674723bcc715c), {
@@ -8758,7 +8843,7 @@ function $22470de5f42cc35d$export$f631859cab12b342(_ref) {
8758
8843
  height: "28"
8759
8844
  });
8760
8845
  }
8761
- }))), $b8hua$escape($b8hua$createComponent(LinkIfPossible, $b8hua$mergeProps({
8846
+ }))), $b8hua$escape($b8hua$createComponent(LinkIfPossible, $b8hua$mergeProps1({
8762
8847
  "class": "content-title line-clamp"
8763
8848
  }, make_link_attributes, {
8764
8849
  get title() {
@@ -8909,7 +8994,7 @@ function $d53ebed6f63304e4$export$6d0c9c22f6652669(_ref) {
8909
8994
  return (0, $69602b3d8fd54c38$export$2452208c79fe93ea).content;
8910
8995
  },
8911
8996
  number_of_results_: num_results
8912
- })), $b8hua$escape($b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $b8hua$mergeProps({
8997
+ })), $b8hua$escape($b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $b8hua$mergeProps1({
8913
8998
  layout: "grid",
8914
8999
  element_attributes: {
8915
9000
  class: "cards"
@@ -9076,7 +9161,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
9076
9161
  var _search_results_4, _search_results_4$con;
9077
9162
  return ((_search_results_4 = search_results_()) !== null && _search_results_4 !== void 0 && (_search_results_4$con = _search_results_4.content_search_links) !== null && _search_results_4$con !== void 0 && _search_results_4$con.length ? i18n_.no_products_ : i18n_.no_results_text_)();
9078
9163
  });
9079
- const results_for = $b8hua$createComponent((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), $b8hua$mergeProps({
9164
+ const results_for = $b8hua$createComponent((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), $b8hua$mergeProps1({
9080
9165
  get type() {
9081
9166
  return (0, $69602b3d8fd54c38$export$2452208c79fe93ea).products;
9082
9167
  },
@@ -70,7 +70,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
70
70
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
71
71
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
72
72
  /*! Depict.ai search and product listing SDK */
73
- const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.4";
73
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.6";
74
74
  const $1ab22f2cd39b3061$var$fallback_operator = "in";
75
75
  const $1ab22f2cd39b3061$var$fallback_token = "";
76
76
  const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
@@ -285,6 +285,7 @@ function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
285
285
  });
286
286
  return size;
287
287
  }
288
+ const $19950faaac026e09$var$onIdleFunctionsSymbol = /*@__PURE__*/Symbol("onIdleFunctions");
288
289
  function $19950faaac026e09$export$6e5611bc7e57e477(props) {
289
290
  // Enable reactive props
290
291
  const otherOptions = $5vyXB$solidjs.createMemo(() => {
@@ -307,11 +308,95 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
307
308
  srcset: srcset
308
309
  };
309
310
  });
310
- return $5vyXB$solidjsweb.ssrElement("img", $5vyXB$solidjsweb.mergeProps(otherOptions, src_options, {
311
- get sizes() {
312
- return props.size() + "px";
313
- }
314
- }), undefined, true);
311
+ // Work around https://github.com/solidjs/solid/issues/1828
312
+ const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
313
+ const [hasSetSize, setHasSetSize] = $5vyXB$solidjs.createSignal(false);
314
+ const [hasDecoded, setHasDecoded] = $5vyXB$solidjs.createSignal(false);
315
+ const sizePX = $5vyXB$solidjs.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
316
+ const listingContext = $84798aaa863a4909$export$8d0c4fdbb05a2f2e();
317
+ // 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
318
+ // Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
319
+ const executeWhenIdleBatched = fn => {
320
+ if (typeof requestIdleCallback !== "function") setTimeout(fn); // Old browsers don't get optimisation
321
+ const existingStack = listingContext?.[$19950faaac026e09$var$onIdleFunctionsSymbol];
322
+ if (existingStack) return existingStack.add(fn);
323
+ const newStack = new Set([fn]);
324
+ if (listingContext) listingContext[$19950faaac026e09$var$onIdleFunctionsSymbol] = newStack;
325
+ const processStackWhenIdle = () => requestIdleCallback(deadline => {
326
+ const start = performance.now();
327
+ const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
328
+ for (const fn of newStack) {
329
+ newStack.delete(fn);
330
+ fn();
331
+ const timeTaken = performance.now() - start;
332
+ if ((!deadline.timeRemaining() || timeTaken > thirdDeadlineTime) && newStack.size) {
333
+ // There's still work to be done but no time, so schedule another idle callback
334
+ processStackWhenIdle();
335
+ return;
336
+ }
337
+ }
338
+ // Stack is empty
339
+ if (listingContext) delete listingContext[$19950faaac026e09$var$onIdleFunctionsSymbol];
340
+ }, {
341
+ timeout: 15000
342
+ } // 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
343
+ );
344
+
345
+ processStackWhenIdle();
346
+ };
347
+ let sizeSetFastPath = false;
348
+ let hasDecodedFastPath = false;
349
+ let timeoutSet = false;
350
+ let gotCleanedUp = false;
351
+ $5vyXB$solidjs.onCleanup(() => gotCleanedUp = true);
352
+ $5vyXB$solidjsweb.spread(img, $5vyXB$solidjs.mergeProps(otherOptions), false, true);
353
+ $5vyXB$solidjs.createEffect(() => {
354
+ if (!props.size()) return; // wait until we have a size
355
+ if (timeoutSet) return;
356
+ const handler = $5vyXB$depictaiutilishared.catchify(() => {
357
+ if (gotCleanedUp) return;
358
+ img.sizes = sizePX(); // use latest available value of props.size
359
+ if (!sizeSetFastPath) {
360
+ setHasSetSize(true);
361
+ sizeSetFastPath = true;
362
+ }
363
+ timeoutSet = false;
364
+ });
365
+ // Throttle the updating of sizes to avoid unnecessary image re-fetches during resize
366
+ // And also because we first set src after sizes has been set, wait with loading and decoding images until browser is idle
367
+ // This greatly improves performance when loading (more) products
368
+ // See https://depictaiworkspace.slack.com/archives/C05NJ0K3WRL/p1698220617663139
369
+ executeWhenIdleBatched(handler);
370
+ timeoutSet = true;
371
+ });
372
+ $5vyXB$solidjs.createEffect(() => {
373
+ 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
374
+ Object.assign(img, src_options());
375
+ // Add to DOM once decoded to not require/block any paints before image has completed loading and avoid showing broken image symbol
376
+ // We can do this because there has to be a container around us giving us a size
377
+ // No need to listen if we're already in the DOM
378
+ if (hasDecodedFastPath) return;
379
+ if (props.loading === "lazy") {
380
+ // For lazy loading there's no decoding to wait for as it only occurs when the image is visible
381
+ // Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
382
+ setHasDecoded(true);
383
+ hasDecodedFastPath = true;
384
+ }
385
+ img.decode().catch(e => $5vyXB$depictaiutilishared.dwarn("Failed to decode image", e, img)) // Display the image also if loading failed so webdev can debug and doesn't get "no image"
386
+ .then(async () => {
387
+ // Also wait with inserting image (i.e. paint) until browser is idle
388
+ await new Promise(r => executeWhenIdleBatched(r));
389
+ if (gotCleanedUp) return;
390
+ setHasDecoded(true);
391
+ hasDecodedFastPath = true;
392
+ });
393
+ });
394
+ return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
395
+ get when() {
396
+ return hasDecoded();
397
+ },
398
+ children: img
399
+ });
315
400
  }
316
401
  function $19950faaac026e09$var$make_srcset(url, resolutions) {
317
402
  return resolutions.map(width => `${$19950faaac026e09$var$generateImageUrl(url, width)} ${width}w`).join(", ");
@@ -349,7 +434,7 @@ function $a33065cfed827fc0$export$e4b984597b71e989(props) {
349
434
  $5vyXB$depictaiutilishared.queueMacroTask(() => setCurrentImageSize(undefined)); // unset the size accessor next event loop iteration, so that all onCleanup's have time to run, since the effects run more aggressively and can create a size accessor with a cleaned up owner otherwise
350
435
  });
351
436
 
352
- container.append($5vyXB$solidjsweb.createComponent((0, $19950faaac026e09$export$6e5611bc7e57e477), {
437
+ $5vyXB$solidjsweb.insert(container, $5vyXB$solidjsweb.createComponent((0, $19950faaac026e09$export$6e5611bc7e57e477), {
353
438
  style: "width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0;",
354
439
  get size() {
355
440
  return $5vyXB$solidjs.createMemo(() => currentImageSize()?.() || 0);
@@ -7,7 +7,7 @@ import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/
7
7
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
8
8
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
9
  import { ProductListingRequestV2 } from "@depict-ai/types/api/ProductListingRequestV2";
10
- export const version = "2.1.4";
10
+ export const version = "2.1.6";
11
11
  /**
12
12
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
13
13
  */
@@ -152,17 +152,19 @@ export function ImageContainer(props: {
152
152
  export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
153
153
  /**
154
154
  * Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
155
+ * Will also delay loading and decoding of image until the browser is idle (with 5s timeout) to improve filtering/loading more performance.
155
156
  * This is used for our responsive images:
156
157
  * 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.
157
158
  * 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
158
159
  * 3. We set the size attribute of all the visible images to the size of the container we're observing. The point of this is that the sizes attribute is used to determine which image to load, and usually it's set by the user and depends on the relationship between image size and viewport size. By using a ResizeObserver, we can make sure the sizes attribute is always set to the correct value without it having to be configured. This will make so the browser always loads the correct image size for a crisp image but still fast load.
160
+ * You need to use insert(domNode, <ShopifyResponsiveImg size={sizeAccessor} src={src} />) if you want to insert the return value of this component into a DOM element manually, where you `import { insert } from "solid-js/web";` because we first want to insert the image once it has loaded.
159
161
  */
160
162
  export function ShopifyResponsiveImg(props: {
161
163
  resolutions?: number[];
162
164
  size: Accessor<number>;
163
165
  } & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes"> & {
164
166
  src: string;
165
- }): HTMLImageElement;
167
+ }): JSX.Element;
166
168
  export const shopifyContainedImageContextSymbol: unique symbol;
167
169
  /**
168
170
  * Abstraction built on top of ShopifyResponsiveImg. This is your one-stop-shop If you just need a responsive image.