@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.
- package/ES10/index.cjs +112 -57
- package/ES10/index.d.ts +17 -4
- package/ES10/index.js +116 -63
- package/latest/index.cjs +110 -56
- package/latest/index.d.ts +17 -4
- package/latest/index.js +114 -62
- package/package.json +1 -1
- package/server/ES10/index.cjs +112 -57
- package/server/ES10/index.d.ts +17 -4
- package/server/ES10/index.js +116 -63
- package/server/latest/index.cjs +110 -56
- package/server/latest/index.d.ts +17 -4
- package/server/latest/index.js +114 -62
package/server/ES10/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { add_to_version_info as $b8hua$add_to_version_info, deparallelize_no_drop as $b8hua$deparallelize_no_drop, catchify as $b8hua$catchify, make_random_classname as $b8hua$make_random_classname, ContainedImage as $b8hua$ContainedImage, standard_price_format as $b8hua$standard_price_format, javascript_media_query as $b8hua$javascript_media_query, dlog as $b8hua$dlog, camelCasifyObject as $b8hua$camelCasifyObject, make_asyncIterable_exiter as $b8hua$make_asyncIterable_exiter, href_change_ipns as $b8hua$href_change_ipns, observer as $b8hua$observer, report as $b8hua$report, base64_encode_unicode as $b8hua$base64_encode_unicode, base64_decode_unicode as $b8hua$base64_decode_unicode,
|
|
2
|
-
import { createSignal as $b8hua$createSignal, createResource as $b8hua$createResource, createEffect as $b8hua$createEffect, untrack as $b8hua$untrack, createMemo as $b8hua$createMemo, onCleanup as $b8hua$onCleanup, Show as $b8hua$Show, createComputed as $b8hua$createComputed, For as $b8hua$For, getOwner as $b8hua$getOwner, runWithOwner as $b8hua$runWithOwner, on as $b8hua$on, Index as $b8hua$Index, batch as $b8hua$batch, ErrorBoundary as $b8hua$ErrorBoundary,
|
|
1
|
+
import { add_to_version_info as $b8hua$add_to_version_info, deparallelize_no_drop as $b8hua$deparallelize_no_drop, catchify as $b8hua$catchify, make_random_classname as $b8hua$make_random_classname, ContainedImage as $b8hua$ContainedImage, standard_price_format as $b8hua$standard_price_format, javascript_media_query as $b8hua$javascript_media_query, dlog as $b8hua$dlog, camelCasifyObject as $b8hua$camelCasifyObject, make_asyncIterable_exiter as $b8hua$make_asyncIterable_exiter, href_change_ipns as $b8hua$href_change_ipns, observer as $b8hua$observer, report as $b8hua$report, base64_encode_unicode as $b8hua$base64_encode_unicode, base64_decode_unicode as $b8hua$base64_decode_unicode, queueMacroTask as $b8hua$queueMacroTask, findMostFrequentItem as $b8hua$findMostFrequentItem, dwarn as $b8hua$dwarn, slider_fading_factory as $b8hua$slider_fading_factory, Amazing_Slider as $b8hua$Amazing_Slider, slider_snap_css as $b8hua$slider_snap_css, 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, use_href_accessor as $b8hua$use_href_accessor, get_session_id as $b8hua$get_session_id, add_version_query_params as $b8hua$add_version_query_params, base_url as $b8hua$base_url, instant_exec_on_suspect_history_change as $b8hua$instant_exec_on_suspect_history_change, slider_fractional_factory as $b8hua$slider_fractional_factory, useExpandingContainer as $b8hua$useExpandingContainer, hex_to_rgb as $b8hua$hex_to_rgb, relative_luminance_from_rgb as $b8hua$relative_luminance_from_rgb, snakeCasifyObject as $b8hua$snakeCasifyObject, fetch_retry as $b8hua$fetch_retry, make_url_with_query_params as $b8hua$make_url_with_query_params, sort_obj as $b8hua$sort_obj, ListenableSet as $b8hua$ListenableSet1, insert_surfaces as $b8hua$insert_surfaces } from "@depict-ai/utilishared/ES10";
|
|
2
|
+
import { createSignal as $b8hua$createSignal, createResource as $b8hua$createResource, createEffect as $b8hua$createEffect, untrack as $b8hua$untrack, createMemo as $b8hua$createMemo, onCleanup as $b8hua$onCleanup, Show as $b8hua$Show, createComputed as $b8hua$createComputed, For as $b8hua$For, getOwner as $b8hua$getOwner, runWithOwner as $b8hua$runWithOwner, createContext as $b8hua$createContext, useContext as $b8hua$useContext, on as $b8hua$on, Index as $b8hua$Index, batch as $b8hua$batch, ErrorBoundary as $b8hua$ErrorBoundary, splitProps as $b8hua$splitProps, mergeProps as $b8hua$mergeProps1, createUniqueId as $b8hua$createUniqueId, createRenderEffect as $b8hua$createRenderEffect, createSelector as $b8hua$createSelector, children as $b8hua$children, createRoot as $b8hua$createRoot, Suspense as $b8hua$Suspense, createReaction as $b8hua$createReaction, mapArray as $b8hua$mapArray } from "solid-js";
|
|
3
3
|
import { ssr as $b8hua$ssr, ssrHydrationKey as $b8hua$ssrHydrationKey, escape as $b8hua$escape, createComponent as $b8hua$createComponent, ssrAttribute as $b8hua$ssrAttribute, ssrClassList as $b8hua$ssrClassList, ssrStyle as $b8hua$ssrStyle, ssrElement as $b8hua$ssrElement, mergeProps as $b8hua$mergeProps, insert as $b8hua$insert, spread as $b8hua$spread, isServer as $b8hua$isServer, Dynamic as $b8hua$Dynamic } from "solid-js/web";
|
|
4
|
-
import { ListenableSet as $b8hua$
|
|
4
|
+
import { ListenableSet as $b8hua$ListenableSet, catchify as $b8hua$catchify1, use_href_accessor as $b8hua$use_href_accessor1, report as $b8hua$report1 } from "@depict-ai/utilishared/ES10";
|
|
5
5
|
import $b8hua$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
import $b8hua$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
|
|
7
7
|
import $b8hua$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
|
|
@@ -10,7 +10,7 @@ import { createStore as $b8hua$createStore, reconcile as $b8hua$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.0.
|
|
13
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "4.0.9";
|
|
14
14
|
function $a604a8ffa4e4c03f$export$e417c49320921907(dependency, fetcher) {
|
|
15
15
|
const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $b8hua$createSignal();
|
|
16
16
|
const deparallelizedFetcher = $b8hua$deparallelize_no_drop(async dependencyValue => {
|
|
@@ -261,6 +261,20 @@ function $cb64b315b25cfc59$var$unwrapping_helper(elements) {
|
|
|
261
261
|
} else if (typeof elements == "function") result.push(...$cb64b315b25cfc59$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
|
|
262
262
|
return result;
|
|
263
263
|
}
|
|
264
|
+
const $1e69163caedaab4e$var$ProductCardIndexContext = /*@__PURE__*/$b8hua$createContext();
|
|
265
|
+
function $1e69163caedaab4e$export$11354f017ddc9790(props) {
|
|
266
|
+
return $b8hua$createComponent($1e69163caedaab4e$var$ProductCardIndexContext.Provider, {
|
|
267
|
+
get value() {
|
|
268
|
+
return props.index_;
|
|
269
|
+
},
|
|
270
|
+
get children() {
|
|
271
|
+
return props.children;
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
function $1e69163caedaab4e$export$e3faf4d95300054f() {
|
|
276
|
+
return $b8hua$useContext($1e69163caedaab4e$var$ProductCardIndexContext);
|
|
277
|
+
}
|
|
264
278
|
let $2d7bad8684bc7f44$var$printedCloneError = false;
|
|
265
279
|
function $2d7bad8684bc7f44$export$7f8bd308237ab5a5(get_displays_) {
|
|
266
280
|
const displays_by_key_ = $b8hua$createMemo(() => {
|
|
@@ -318,9 +332,22 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
|
318
332
|
$b8hua$dlog("Can't clone display", display, " (uncloneable objects in it), make sure you don't mutate it in the template since we cache.", e);
|
|
319
333
|
}
|
|
320
334
|
}
|
|
321
|
-
|
|
322
|
-
|
|
335
|
+
let renderingResult;
|
|
336
|
+
// Wrap the product card in a ProductCardIndexProvider so that the index is available to the product card
|
|
337
|
+
// This is wo we can do intelligent image loading in ShopifyContainedImage without shopify devs having to pass in the index
|
|
338
|
+
// 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
|
|
339
|
+
$1e69163caedaab4e$export$11354f017ddc9790({
|
|
340
|
+
index_: index,
|
|
341
|
+
get children() {
|
|
342
|
+
// 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
|
|
343
|
+
renderingResult = product_card_template_(display, {
|
|
344
|
+
set_on_index_change: fn => $b8hua$runWithOwner(owner, () => $b8hua$createEffect(() => fn(index())))
|
|
345
|
+
});
|
|
346
|
+
return undefined; // just to satisfy the typing
|
|
347
|
+
}
|
|
323
348
|
});
|
|
349
|
+
// 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)
|
|
350
|
+
return renderingResult;
|
|
324
351
|
});
|
|
325
352
|
const node_accessor = $cb64b315b25cfc59$export$2f0cbfbb4354bb52(product_card_resource);
|
|
326
353
|
$b8hua$createEffect(() => {
|
|
@@ -345,7 +372,8 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
|
345
372
|
});
|
|
346
373
|
return [
|
|
347
374
|
// Show content block before product card, so it's *at* that index
|
|
348
|
-
possible_content_block,
|
|
375
|
+
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,
|
|
376
|
+
]; // Regarding the as unknown shenanigans: https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
349
377
|
}
|
|
350
378
|
});
|
|
351
379
|
}
|
|
@@ -1852,6 +1880,34 @@ var $801e8845d3fa3653$var$_tmpl$ = ["<div", ' class="', '" style="', '">', "</di
|
|
|
1852
1880
|
function $801e8845d3fa3653$export$94026ee33dbabc26(props) {
|
|
1853
1881
|
return $b8hua$ssr($801e8845d3fa3653$var$_tmpl$, $b8hua$ssrHydrationKey(), "".concat($b8hua$escape($b8hua$escape("s-image-container", true), true)).concat($b8hua$escape(props.class, true) || ""), $b8hua$ssrStyle("padding-bottom:calc(calc(1 / ".concat(props.aspectRatio, ") * 100%)")), $b8hua$escape(props.children));
|
|
1854
1882
|
}
|
|
1883
|
+
let $6db93f70c2db1486$var$browserIsBugged = false;
|
|
1884
|
+
function $6db93f70c2db1486$export$2972b890694ced75(callback, _ref) {
|
|
1885
|
+
let {
|
|
1886
|
+
timeout: timeout
|
|
1887
|
+
} = _ref;
|
|
1888
|
+
if ($6db93f70c2db1486$var$browserIsBugged) timeout /= 4;
|
|
1889
|
+
const cancel = () => {
|
|
1890
|
+
cancelIdleCallback(idleHandle);
|
|
1891
|
+
clearTimeout(racingTimeout);
|
|
1892
|
+
};
|
|
1893
|
+
const idleHandle = requestIdleCallback(deadline => {
|
|
1894
|
+
cancel();
|
|
1895
|
+
return callback(deadline);
|
|
1896
|
+
}, {
|
|
1897
|
+
timeout: timeout
|
|
1898
|
+
});
|
|
1899
|
+
const racingTimeout = setTimeout(() => {
|
|
1900
|
+
$6db93f70c2db1486$var$browserIsBugged = true;
|
|
1901
|
+
cancel();
|
|
1902
|
+
callback({
|
|
1903
|
+
didTimeout: false,
|
|
1904
|
+
timeRemaining() {
|
|
1905
|
+
return 500;
|
|
1906
|
+
}
|
|
1907
|
+
});
|
|
1908
|
+
}, timeout + 1000);
|
|
1909
|
+
return cancel;
|
|
1910
|
+
}
|
|
1855
1911
|
function $56047603f9d212b6$export$e6fffe67d4cdd848(whatToWatch) {
|
|
1856
1912
|
const [size, setSize] = $b8hua$createSignal(0);
|
|
1857
1913
|
const resizeObserver = new ResizeObserver($b8hua$catchify(records => {
|
|
@@ -1879,23 +1935,11 @@ function $56047603f9d212b6$export$e6fffe67d4cdd848(whatToWatch) {
|
|
|
1879
1935
|
}
|
|
1880
1936
|
const $56047603f9d212b6$var$onIdleFunctionsSymbol = /*@__PURE__*/Symbol("onIdleFunctions");
|
|
1881
1937
|
const $56047603f9d212b6$export$f8945274f08a3105 = /*@__PURE__*/Symbol("listingContextAspectRatios");
|
|
1938
|
+
const $56047603f9d212b6$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingContextAspectRatios");
|
|
1882
1939
|
function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
1883
|
-
// Enable reactive props
|
|
1884
|
-
const otherOptions = $b8hua$createMemo(() => {
|
|
1885
|
-
const cloned_props = {
|
|
1886
|
-
...props
|
|
1887
|
-
};
|
|
1888
|
-
delete cloned_props.resolutions;
|
|
1889
|
-
// @ts-ignore
|
|
1890
|
-
delete cloned_props.size;
|
|
1891
|
-
// @ts-ignore
|
|
1892
|
-
delete cloned_props.src;
|
|
1893
|
-
return cloned_props;
|
|
1894
|
-
});
|
|
1895
1940
|
const src_options = $b8hua$createMemo(() => {
|
|
1896
|
-
const
|
|
1897
|
-
const
|
|
1898
|
-
const srcset = $56047603f9d212b6$var$make_srcset(src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096]);
|
|
1941
|
+
const fallback_src = $56047603f9d212b6$var$generateImageUrl(props.src, 400);
|
|
1942
|
+
const srcset = $56047603f9d212b6$var$make_srcset(props.src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096]);
|
|
1899
1943
|
// The order here *might* matter - I've seen mobile safari always start with loading the 400px version when it was reversed
|
|
1900
1944
|
return {
|
|
1901
1945
|
srcset: srcset,
|
|
@@ -1904,19 +1948,35 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1904
1948
|
});
|
|
1905
1949
|
// Work around https://github.com/solidjs/solid/issues/1828
|
|
1906
1950
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
1951
|
+
const [, otherAttributes] = $b8hua$splitProps(props, ["resolutions", "size", "src", "srcSet", "loading"]);
|
|
1907
1952
|
const [hasSetSize, setHasSetSize] = $b8hua$createSignal(false);
|
|
1908
1953
|
const [hasDecoded, setHasDecoded] = $b8hua$createSignal(false);
|
|
1954
|
+
const productCardIndexAccessor = $1e69163caedaab4e$export$e3faf4d95300054f();
|
|
1909
1955
|
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
|
|
1910
1956
|
const listingContext = $5441862cd2f5e111$export$8d0c4fdbb05a2f2e();
|
|
1957
|
+
const isPrioritisedImage = $b8hua$createMemo(() => (productCardIndexAccessor === null || productCardIndexAccessor === void 0 ? void 0 : productCardIndexAccessor()) < 8);
|
|
1958
|
+
const shouldActuallyEnableLazyLoading = $b8hua$createMemo(() => {
|
|
1959
|
+
const {
|
|
1960
|
+
loading: loading
|
|
1961
|
+
} = props;
|
|
1962
|
+
if (loading === "force-lazy") return true;
|
|
1963
|
+
return loading === "lazy" && !isPrioritisedImage();
|
|
1964
|
+
});
|
|
1965
|
+
const modifiedOtherAttributes = $b8hua$mergeProps1(otherAttributes, {
|
|
1966
|
+
get loading() {
|
|
1967
|
+
return shouldActuallyEnableLazyLoading() ? "lazy" : undefined;
|
|
1968
|
+
}
|
|
1969
|
+
});
|
|
1911
1970
|
// 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
|
|
1912
1971
|
// Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
|
|
1913
1972
|
const executeWhenIdleBatched = fn => {
|
|
1914
1973
|
if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
|
|
1974
|
+
if ($b8hua$untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately
|
|
1915
1975
|
const existingStack = listingContext === null || listingContext === void 0 ? void 0 : listingContext[$56047603f9d212b6$var$onIdleFunctionsSymbol];
|
|
1916
1976
|
if (existingStack) return existingStack.add(fn);
|
|
1917
1977
|
const newStack = new Set([fn]);
|
|
1918
1978
|
if (listingContext) listingContext[$56047603f9d212b6$var$onIdleFunctionsSymbol] = newStack;
|
|
1919
|
-
const processStackWhenIdle = () =>
|
|
1979
|
+
const processStackWhenIdle = () => $6db93f70c2db1486$export$2972b890694ced75($b8hua$catchify(deadline => {
|
|
1920
1980
|
const start = performance.now();
|
|
1921
1981
|
const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
|
|
1922
1982
|
for (const fn of newStack) {
|
|
@@ -1931,7 +1991,7 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1931
1991
|
}
|
|
1932
1992
|
// Stack is empty
|
|
1933
1993
|
if (listingContext) delete listingContext[$56047603f9d212b6$var$onIdleFunctionsSymbol];
|
|
1934
|
-
}, {
|
|
1994
|
+
}), {
|
|
1935
1995
|
timeout: 15000
|
|
1936
1996
|
} // 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
|
|
1937
1997
|
);
|
|
@@ -1945,7 +2005,8 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1945
2005
|
img.classList.add("s-responsive-image");
|
|
1946
2006
|
if (listingContext) {
|
|
1947
2007
|
let prevValue;
|
|
1948
|
-
const aspectRatios = listingContext[$56047603f9d212b6$export$f8945274f08a3105] || (listingContext[$56047603f9d212b6$export$f8945274f08a3105] = new (
|
|
2008
|
+
const aspectRatios = listingContext[$56047603f9d212b6$export$f8945274f08a3105] || (listingContext[$56047603f9d212b6$export$f8945274f08a3105] = new Set());
|
|
2009
|
+
const [, setMostPrevalentAspectRatio] = listingContext[$56047603f9d212b6$export$6066eb417ed2e9f7] || (listingContext[$56047603f9d212b6$export$6066eb417ed2e9f7] = $b8hua$createSignal());
|
|
1949
2010
|
img.addEventListener("load", $b8hua$catchify(() => {
|
|
1950
2011
|
// Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2
|
|
1951
2012
|
const aspectRatio_ = img.naturalWidth / img.naturalHeight;
|
|
@@ -1955,13 +2016,22 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1955
2016
|
} : undefined;
|
|
1956
2017
|
if (newValue) aspectRatios.add(newValue);
|
|
1957
2018
|
prevValue = newValue;
|
|
2019
|
+
// Do all calculations resulting of an update directly, for performance
|
|
2020
|
+
const asArray = [...aspectRatios].map(_ref2 => {
|
|
2021
|
+
let {
|
|
2022
|
+
aspectRatio_: aspectRatio_
|
|
2023
|
+
} = _ref2;
|
|
2024
|
+
return aspectRatio_;
|
|
2025
|
+
});
|
|
2026
|
+
const mostPrevalentAspectRatio = $b8hua$findMostFrequentItem(asArray);
|
|
2027
|
+
setMostPrevalentAspectRatio(mostPrevalentAspectRatio);
|
|
1958
2028
|
}));
|
|
1959
2029
|
$b8hua$onCleanup(() => prevValue && aspectRatios.delete(prevValue));
|
|
1960
2030
|
}
|
|
1961
2031
|
$b8hua$onCleanup(() => gotCleanedUp = true);
|
|
1962
|
-
$b8hua$spread(img, $b8hua$mergeProps1(
|
|
2032
|
+
$b8hua$spread(img, $b8hua$mergeProps1(modifiedOtherAttributes), false, true);
|
|
1963
2033
|
$b8hua$createEffect(() => {
|
|
1964
|
-
if (!props.size()) return; // wait until we have a size
|
|
2034
|
+
if (!props.size()) return; // wait until we have a size, run every time the size changes
|
|
1965
2035
|
if (timeoutSet) return;
|
|
1966
2036
|
const handler = $b8hua$catchify(() => {
|
|
1967
2037
|
if (gotCleanedUp) return;
|
|
@@ -1986,7 +2056,7 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1986
2056
|
// We can do this because there has to be a container around us giving us a size
|
|
1987
2057
|
// No need to listen if we're already in the DOM
|
|
1988
2058
|
if (hasDecodedFastPath) return;
|
|
1989
|
-
if (
|
|
2059
|
+
if (shouldActuallyEnableLazyLoading()) {
|
|
1990
2060
|
// For lazy loading there's no decoding to wait for as it only occurs when the image is visible
|
|
1991
2061
|
// Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
|
|
1992
2062
|
setHasDecoded(true);
|
|
@@ -2013,9 +2083,10 @@ function $56047603f9d212b6$var$make_srcset(url, resolutions) {
|
|
|
2013
2083
|
return resolutions.map(width => "".concat($56047603f9d212b6$var$generateImageUrl(url, width), " ").concat(width, "w")).join(", ");
|
|
2014
2084
|
}
|
|
2015
2085
|
function $56047603f9d212b6$var$generateImageUrl(url, width) {
|
|
2016
|
-
//
|
|
2017
|
-
url
|
|
2018
|
-
|
|
2086
|
+
// 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)
|
|
2087
|
+
// 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)
|
|
2088
|
+
// That way we can just to string concatenation which is insanely fast
|
|
2089
|
+
return url + "&width=" + encodeURIComponent(width);
|
|
2019
2090
|
}
|
|
2020
2091
|
const $4df489344a0f97c7$var$backupSizeSignal = /*@__PURE__*/$b8hua$createSignal();
|
|
2021
2092
|
const $4df489344a0f97c7$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
|
|
@@ -2025,41 +2096,23 @@ function $4df489344a0f97c7$export$e4b984597b71e989(props) {
|
|
|
2025
2096
|
// create a signal that's the same for all items in this listing
|
|
2026
2097
|
context[$4df489344a0f97c7$export$d7b7ab832c20e2f4] = $b8hua$createSignal();
|
|
2027
2098
|
const [currentImageSize, setCurrentImageSize] = (context === null || context === void 0 ? void 0 : context[$4df489344a0f97c7$export$d7b7ab832c20e2f4]) || $4df489344a0f97c7$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
|
|
2028
|
-
const
|
|
2029
|
-
const
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
const aspectRatioToUse = $b8hua$createMemo(() => {
|
|
2033
|
-
const aspectRatiosSet = aspectRatios(); // This signal "changes" to the same set every time the set changes, so we can use it as a dependency here
|
|
2034
|
-
useMostPrevalentAspectRatio: {
|
|
2035
|
-
if (!aspectRatiosSet || !props.autoAdjustAspectRatio) break useMostPrevalentAspectRatio;
|
|
2036
|
-
// Get the aspect ratio that most of the loaded images inside the ListingProvider we are, load
|
|
2037
|
-
const asArray = [...aspectRatiosSet].map(_ref => {
|
|
2038
|
-
let {
|
|
2039
|
-
aspectRatio_: aspectRatio_
|
|
2040
|
-
} = _ref;
|
|
2041
|
-
return aspectRatio_;
|
|
2042
|
-
});
|
|
2043
|
-
const mostPrevalentAspectRatio = $b8hua$findMostFrequentItem(asArray);
|
|
2044
|
-
if (mostPrevalentAspectRatio) return "var(".concat((0, $5eaa00b951637e96$export$8a2234b5b1a5ebd4), ", ").concat(mostPrevalentAspectRatio, ")");
|
|
2045
|
-
}
|
|
2046
|
-
return props.aspectRatio;
|
|
2047
|
-
});
|
|
2048
|
-
const container = $b8hua$createComponent((0, $801e8845d3fa3653$export$94026ee33dbabc26), {
|
|
2049
|
-
get aspectRatio() {
|
|
2050
|
-
return aspectRatioToUse();
|
|
2051
|
-
},
|
|
2052
|
-
get ["class"]() {
|
|
2099
|
+
const [mostPrevalentAspectRatio] = context ? context[(0, $56047603f9d212b6$export$6066eb417ed2e9f7)] || (context[(0, $56047603f9d212b6$export$6066eb417ed2e9f7)] = $b8hua$createSignal()) : [];
|
|
2100
|
+
const container = $801e8845d3fa3653$export$94026ee33dbabc26({
|
|
2101
|
+
// Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
|
|
2102
|
+
get class() {
|
|
2053
2103
|
return props.class;
|
|
2104
|
+
},
|
|
2105
|
+
get aspectRatio() {
|
|
2106
|
+
if (props.autoAdjustAspectRatio) {
|
|
2107
|
+
const targetRatio = mostPrevalentAspectRatio === null || mostPrevalentAspectRatio === void 0 ? void 0 : mostPrevalentAspectRatio();
|
|
2108
|
+
if (targetRatio != undefined) return "var(".concat((0, $5eaa00b951637e96$export$8a2234b5b1a5ebd4), ", ").concat(targetRatio, ")");
|
|
2109
|
+
}
|
|
2110
|
+
return props.aspectRatio;
|
|
2054
2111
|
}
|
|
2055
2112
|
});
|
|
2056
2113
|
const owner = $b8hua$getOwner();
|
|
2057
2114
|
let createdSizeAccessor = false;
|
|
2058
2115
|
let wasCleanedUp = false;
|
|
2059
|
-
for (const event of ["add", "delete"]) {
|
|
2060
|
-
aspectRatiosSet === null || aspectRatiosSet === void 0 || aspectRatiosSet.addEventListener(event, () => setAspectRatios(aspectRatiosSet));
|
|
2061
|
-
$b8hua$onCleanup(() => aspectRatiosSet === null || aspectRatiosSet === void 0 ? void 0 : aspectRatiosSet.removeEventListener(event, () => setAspectRatios(aspectRatiosSet)));
|
|
2062
|
-
}
|
|
2063
2116
|
$b8hua$createEffect(() => {
|
|
2064
2117
|
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
2065
2118
|
// ensure we always have a size accessor
|
|
@@ -3032,7 +3085,7 @@ const $6a439680ae7e9ba3$var$TabsContext = /*@__PURE__*/$b8hua$createContext();
|
|
|
3032
3085
|
const $6a439680ae7e9ba3$var$useTabs = () => $b8hua$useContext($6a439680ae7e9ba3$var$TabsContext);
|
|
3033
3086
|
function $6a439680ae7e9ba3$export$b2539bed5023c21c(props) {
|
|
3034
3087
|
return $b8hua$createComponent($6a439680ae7e9ba3$var$TabsContext.Provider, {
|
|
3035
|
-
value: new (0, $b8hua$
|
|
3088
|
+
value: new (0, $b8hua$ListenableSet)(),
|
|
3036
3089
|
get children() {
|
|
3037
3090
|
return $b8hua$createComponent($6a439680ae7e9ba3$var$ActualTabs, $b8hua$mergeProps(props, {
|
|
3038
3091
|
get children() {
|
|
@@ -10960,7 +11013,7 @@ function $d53ebed6f63304e4$export$6d0c9c22f6652669(_ref) {
|
|
|
10960
11013
|
number_: num_results,
|
|
10961
11014
|
i18n_: i18n_
|
|
10962
11015
|
});
|
|
10963
|
-
const queries_without_content_results_ = new (0, $b8hua$
|
|
11016
|
+
const queries_without_content_results_ = new (0, $b8hua$ListenableSet1)();
|
|
10964
11017
|
const [check_query, set_check_query] = $b8hua$createSignal(false);
|
|
10965
11018
|
const placeholders_enabled = $b8hua$createMemo(() => {
|
|
10966
11019
|
// don't show placeholders when the user toggles filters
|
|
@@ -12617,4 +12670,4 @@ function $a3026fb727bc7550$var$align_field_modal(alignmentSignals, input, modalV
|
|
|
12617
12670
|
});
|
|
12618
12671
|
}
|
|
12619
12672
|
$b8hua$add_to_version_info("ui", (0, $8db9a15135765c11$export$83d89fbfd8236492));
|
|
12620
|
-
export { $a604a8ffa4e4c03f$export$e417c49320921907 as createDeparallelizedNoDropResource, $01c33966d9ddb108$export$f50b88e2a00918b5 as throw_globally, $40411f2ec772c376$export$9265e66f26f8e383 as ClassicSearchModal, $06fcd2a345efd24d$export$b0c55aa2e87c4be7 as SearchModalV2, $7fbaab3d3dafb4f5$export$9d4a4b669b1929ab as ModernResponsiveContainedImage, $6a439680ae7e9ba3$export$3e41faf802a29e71 as Tab, $6a439680ae7e9ba3$export$b2539bed5023c21c as Tabs, $6b0fd8fd20df8ccf$export$d4973c31938cbfd1 as ShopTheLookButton, $972f6bce0f9d61be$export$e183a13865960371 as history_dot_state_to_state, $2855bffe06ef7a03$export$916e6850778505f6 as strip_encoded_filter_and_sort, $2855bffe06ef7a03$export$58aa3f171519b6d7 as encode_filters, $2855bffe06ef7a03$export$f934fa24c3a86811 as decode_filters, $2855bffe06ef7a03$export$62acb285a7579555 as encode_sorting, $2855bffe06ef7a03$export$766e9676e74997d3 as decode_sorting, $4df489344a0f97c7$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $5441862cd2f5e111$export$e68cff63f76bd15b as ListingProvider, $5441862cd2f5e111$export$8d0c4fdbb05a2f2e as useListing, $4df489344a0f97c7$export$e4b984597b71e989 as ShopifyContainedImage, $002f09d00aac50b2$export$6649caad96ef8870 as SlidableItems, $fc830a7ee59416ef$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $56047603f9d212b6$export$e6fffe67d4cdd848 as makeSizeAccessor, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $50aebf5b445518eb$export$58e808b1db15d3bc as fetchDepictRecommendations, $f5f54892fd0c7d9f$export$de035477d6fef996 as QuickLinks, $f5f54892fd0c7d9f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $160ea2b55d8772d2$export$c1a6b039e689a58e as get_listings, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $f5f54892fd0c7d9f$export$e2bf8ce7779e827e as CategoryPage, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $1308a7816c3d4f2d$export$3f238c96c45e6cc6 as ALIGN_TOP, $1308a7816c3d4f2d$export$902f8b4a7dae5d78 as ALIGN_WIDTH_ON_MODAL, $1308a7816c3d4f2d$export$7895aadd1956b1c7 as ALIGN_LEFT, $1308a7816c3d4f2d$export$6060bc6bee850eb6 as SET_CENTERED_LEFT, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version, $a3026fb727bc7550$export$316f6f283ae64765 as SearchField };
|
|
12673
|
+
export { $a604a8ffa4e4c03f$export$e417c49320921907 as createDeparallelizedNoDropResource, $01c33966d9ddb108$export$f50b88e2a00918b5 as throw_globally, $40411f2ec772c376$export$9265e66f26f8e383 as ClassicSearchModal, $06fcd2a345efd24d$export$b0c55aa2e87c4be7 as SearchModalV2, $7fbaab3d3dafb4f5$export$9d4a4b669b1929ab as ModernResponsiveContainedImage, $6a439680ae7e9ba3$export$3e41faf802a29e71 as Tab, $6a439680ae7e9ba3$export$b2539bed5023c21c as Tabs, $6b0fd8fd20df8ccf$export$d4973c31938cbfd1 as ShopTheLookButton, $972f6bce0f9d61be$export$e183a13865960371 as history_dot_state_to_state, $2855bffe06ef7a03$export$916e6850778505f6 as strip_encoded_filter_and_sort, $2855bffe06ef7a03$export$58aa3f171519b6d7 as encode_filters, $2855bffe06ef7a03$export$f934fa24c3a86811 as decode_filters, $2855bffe06ef7a03$export$62acb285a7579555 as encode_sorting, $2855bffe06ef7a03$export$766e9676e74997d3 as decode_sorting, $4df489344a0f97c7$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $5441862cd2f5e111$export$e68cff63f76bd15b as ListingProvider, $5441862cd2f5e111$export$8d0c4fdbb05a2f2e as useListing, $1e69163caedaab4e$export$11354f017ddc9790 as ProductCardIndexProvider, $1e69163caedaab4e$export$e3faf4d95300054f as useProductCardIndex, $4df489344a0f97c7$export$e4b984597b71e989 as ShopifyContainedImage, $002f09d00aac50b2$export$6649caad96ef8870 as SlidableItems, $fc830a7ee59416ef$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $56047603f9d212b6$export$e6fffe67d4cdd848 as makeSizeAccessor, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $50aebf5b445518eb$export$58e808b1db15d3bc as fetchDepictRecommendations, $f5f54892fd0c7d9f$export$de035477d6fef996 as QuickLinks, $f5f54892fd0c7d9f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $160ea2b55d8772d2$export$c1a6b039e689a58e as get_listings, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $f5f54892fd0c7d9f$export$e2bf8ce7779e827e as CategoryPage, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $1308a7816c3d4f2d$export$3f238c96c45e6cc6 as ALIGN_TOP, $1308a7816c3d4f2d$export$902f8b4a7dae5d78 as ALIGN_WIDTH_ON_MODAL, $1308a7816c3d4f2d$export$7895aadd1956b1c7 as ALIGN_LEFT, $1308a7816c3d4f2d$export$6060bc6bee850eb6 as SET_CENTERED_LEFT, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version, $a3026fb727bc7550$export$316f6f283ae64765 as SearchField };
|
package/server/latest/index.cjs
CHANGED
|
@@ -29,6 +29,8 @@ $parcel$export(module.exports, "decode_sorting", () => $1ab22f2cd39b3061$export$
|
|
|
29
29
|
$parcel$export(module.exports, "shopifyContainedImageContextSymbol", () => $a33065cfed827fc0$export$d7b7ab832c20e2f4);
|
|
30
30
|
$parcel$export(module.exports, "ListingProvider", () => $84798aaa863a4909$export$e68cff63f76bd15b);
|
|
31
31
|
$parcel$export(module.exports, "useListing", () => $84798aaa863a4909$export$8d0c4fdbb05a2f2e);
|
|
32
|
+
$parcel$export(module.exports, "ProductCardIndexProvider", () => $129b9b9c010039d0$export$11354f017ddc9790);
|
|
33
|
+
$parcel$export(module.exports, "useProductCardIndex", () => $129b9b9c010039d0$export$e3faf4d95300054f);
|
|
32
34
|
$parcel$export(module.exports, "ShopifyContainedImage", () => $a33065cfed827fc0$export$e4b984597b71e989);
|
|
33
35
|
$parcel$export(module.exports, "SlidableItems", () => $a0e53f99354809d9$export$6649caad96ef8870);
|
|
34
36
|
$parcel$export(module.exports, "make_accurate_width_accessor", () => $f13855d1b951b24a$export$ebdc3711f7e02ccd);
|
|
@@ -86,7 +88,7 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad99
|
|
|
86
88
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
87
89
|
$parcel$export(module.exports, "SearchField", () => $c0a0659cf97e8eb2$export$316f6f283ae64765);
|
|
88
90
|
/*! Depict.ai search and product listing SDK */
|
|
89
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.0.
|
|
91
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.0.9";
|
|
90
92
|
function $53df95e470b2f8d2$export$e417c49320921907(dependency, fetcher) {
|
|
91
93
|
const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $5vyXB$solidjs.createSignal();
|
|
92
94
|
const deparallelizedFetcher = $5vyXB$depictaiutilishared.deparallelize_no_drop(async dependencyValue => {
|
|
@@ -324,6 +326,20 @@ function $5f7d55c710fd1bc2$var$unwrapping_helper(elements) {
|
|
|
324
326
|
} else if (typeof elements == "function") result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
|
|
325
327
|
return result;
|
|
326
328
|
}
|
|
329
|
+
const $129b9b9c010039d0$var$ProductCardIndexContext = /*@__PURE__*/$5vyXB$solidjs.createContext();
|
|
330
|
+
function $129b9b9c010039d0$export$11354f017ddc9790(props) {
|
|
331
|
+
return $5vyXB$solidjsweb.createComponent($129b9b9c010039d0$var$ProductCardIndexContext.Provider, {
|
|
332
|
+
get value() {
|
|
333
|
+
return props.index_;
|
|
334
|
+
},
|
|
335
|
+
get children() {
|
|
336
|
+
return props.children;
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function $129b9b9c010039d0$export$e3faf4d95300054f() {
|
|
341
|
+
return $5vyXB$solidjs.useContext($129b9b9c010039d0$var$ProductCardIndexContext);
|
|
342
|
+
}
|
|
327
343
|
let $a73063cc642f3e5f$var$printedCloneError = false;
|
|
328
344
|
function $a73063cc642f3e5f$export$7f8bd308237ab5a5(get_displays_) {
|
|
329
345
|
const displays_by_key_ = $5vyXB$solidjs.createMemo(() => {
|
|
@@ -377,9 +393,22 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
|
377
393
|
$5vyXB$depictaiutilishared.dlog("Can't clone display", display, " (uncloneable objects in it), make sure you don't mutate it in the template since we cache.", e);
|
|
378
394
|
}
|
|
379
395
|
}
|
|
380
|
-
|
|
381
|
-
|
|
396
|
+
let renderingResult;
|
|
397
|
+
// Wrap the product card in a ProductCardIndexProvider so that the index is available to the product card
|
|
398
|
+
// This is wo we can do intelligent image loading in ShopifyContainedImage without shopify devs having to pass in the index
|
|
399
|
+
// 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
|
|
400
|
+
$129b9b9c010039d0$export$11354f017ddc9790({
|
|
401
|
+
index_: index,
|
|
402
|
+
get children() {
|
|
403
|
+
// 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
|
|
404
|
+
renderingResult = product_card_template_(display, {
|
|
405
|
+
set_on_index_change: fn => $5vyXB$solidjs.runWithOwner(owner, () => $5vyXB$solidjs.createEffect(() => fn(index())))
|
|
406
|
+
});
|
|
407
|
+
return undefined; // just to satisfy the typing
|
|
408
|
+
}
|
|
382
409
|
});
|
|
410
|
+
// 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)
|
|
411
|
+
return renderingResult;
|
|
383
412
|
});
|
|
384
413
|
const node_accessor = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(product_card_resource);
|
|
385
414
|
$5vyXB$solidjs.createEffect(() => {
|
|
@@ -404,7 +433,8 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
|
404
433
|
});
|
|
405
434
|
return [
|
|
406
435
|
// Show content block before product card, so it's *at* that index
|
|
407
|
-
possible_content_block,
|
|
436
|
+
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,
|
|
437
|
+
]; // Regarding the as unknown shenanigans: https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
408
438
|
}
|
|
409
439
|
});
|
|
410
440
|
}
|
|
@@ -1841,6 +1871,33 @@ var $93304d59a9747aa6$var$_tmpl$ = ["<div", ' class="', '" style="', '">', "</di
|
|
|
1841
1871
|
function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
|
|
1842
1872
|
return $5vyXB$solidjsweb.ssr($93304d59a9747aa6$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), `${$5vyXB$solidjsweb.escape($5vyXB$solidjsweb.escape("s-image-container", true), true)} ${$5vyXB$solidjsweb.escape(props.class, true) || ""}`, $5vyXB$solidjsweb.ssrStyle(`padding-bottom:calc(calc(1 / ${props.aspectRatio}) * 100%)`), $5vyXB$solidjsweb.escape(props.children));
|
|
1843
1873
|
}
|
|
1874
|
+
let $3ea8e0af95b5b7d2$var$browserIsBugged = false;
|
|
1875
|
+
function $3ea8e0af95b5b7d2$export$2972b890694ced75(callback, {
|
|
1876
|
+
timeout: timeout
|
|
1877
|
+
}) {
|
|
1878
|
+
if ($3ea8e0af95b5b7d2$var$browserIsBugged) timeout /= 4;
|
|
1879
|
+
const cancel = () => {
|
|
1880
|
+
cancelIdleCallback(idleHandle);
|
|
1881
|
+
clearTimeout(racingTimeout);
|
|
1882
|
+
};
|
|
1883
|
+
const idleHandle = requestIdleCallback(deadline => {
|
|
1884
|
+
cancel();
|
|
1885
|
+
return callback(deadline);
|
|
1886
|
+
}, {
|
|
1887
|
+
timeout: timeout
|
|
1888
|
+
});
|
|
1889
|
+
const racingTimeout = setTimeout(() => {
|
|
1890
|
+
$3ea8e0af95b5b7d2$var$browserIsBugged = true;
|
|
1891
|
+
cancel();
|
|
1892
|
+
callback({
|
|
1893
|
+
didTimeout: false,
|
|
1894
|
+
timeRemaining() {
|
|
1895
|
+
return 500;
|
|
1896
|
+
}
|
|
1897
|
+
});
|
|
1898
|
+
}, timeout + 1000);
|
|
1899
|
+
return cancel;
|
|
1900
|
+
}
|
|
1844
1901
|
function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
|
|
1845
1902
|
const [size, setSize] = $5vyXB$solidjs.createSignal(0);
|
|
1846
1903
|
const resizeObserver = new ResizeObserver($5vyXB$depictaiutilishared.catchify(records => {
|
|
@@ -1865,23 +1922,11 @@ function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
|
|
|
1865
1922
|
}
|
|
1866
1923
|
const $19950faaac026e09$var$onIdleFunctionsSymbol = /*@__PURE__*/Symbol("onIdleFunctions");
|
|
1867
1924
|
const $19950faaac026e09$export$f8945274f08a3105 = /*@__PURE__*/Symbol("listingContextAspectRatios");
|
|
1925
|
+
const $19950faaac026e09$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingContextAspectRatios");
|
|
1868
1926
|
function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
1869
|
-
// Enable reactive props
|
|
1870
|
-
const otherOptions = $5vyXB$solidjs.createMemo(() => {
|
|
1871
|
-
const cloned_props = {
|
|
1872
|
-
...props
|
|
1873
|
-
};
|
|
1874
|
-
delete cloned_props.resolutions;
|
|
1875
|
-
// @ts-ignore
|
|
1876
|
-
delete cloned_props.size;
|
|
1877
|
-
// @ts-ignore
|
|
1878
|
-
delete cloned_props.src;
|
|
1879
|
-
return cloned_props;
|
|
1880
|
-
});
|
|
1881
1927
|
const src_options = $5vyXB$solidjs.createMemo(() => {
|
|
1882
|
-
const
|
|
1883
|
-
const
|
|
1884
|
-
const srcset = $19950faaac026e09$var$make_srcset(src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096]);
|
|
1928
|
+
const fallback_src = $19950faaac026e09$var$generateImageUrl(props.src, 400);
|
|
1929
|
+
const srcset = $19950faaac026e09$var$make_srcset(props.src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096]);
|
|
1885
1930
|
// The order here *might* matter - I've seen mobile safari always start with loading the 400px version when it was reversed
|
|
1886
1931
|
return {
|
|
1887
1932
|
srcset: srcset,
|
|
@@ -1890,19 +1935,35 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
1890
1935
|
});
|
|
1891
1936
|
// Work around https://github.com/solidjs/solid/issues/1828
|
|
1892
1937
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
1938
|
+
const [, otherAttributes] = $5vyXB$solidjs.splitProps(props, ["resolutions", "size", "src", "srcSet", "loading"]);
|
|
1893
1939
|
const [hasSetSize, setHasSetSize] = $5vyXB$solidjs.createSignal(false);
|
|
1894
1940
|
const [hasDecoded, setHasDecoded] = $5vyXB$solidjs.createSignal(false);
|
|
1941
|
+
const productCardIndexAccessor = $129b9b9c010039d0$export$e3faf4d95300054f();
|
|
1895
1942
|
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
|
|
1896
1943
|
const listingContext = $84798aaa863a4909$export$8d0c4fdbb05a2f2e();
|
|
1944
|
+
const isPrioritisedImage = $5vyXB$solidjs.createMemo(() => productCardIndexAccessor?.() < 8);
|
|
1945
|
+
const shouldActuallyEnableLazyLoading = $5vyXB$solidjs.createMemo(() => {
|
|
1946
|
+
const {
|
|
1947
|
+
loading: loading
|
|
1948
|
+
} = props;
|
|
1949
|
+
if (loading === "force-lazy") return true;
|
|
1950
|
+
return loading === "lazy" && !isPrioritisedImage();
|
|
1951
|
+
});
|
|
1952
|
+
const modifiedOtherAttributes = $5vyXB$solidjs.mergeProps(otherAttributes, {
|
|
1953
|
+
get loading() {
|
|
1954
|
+
return shouldActuallyEnableLazyLoading() ? "lazy" : undefined;
|
|
1955
|
+
}
|
|
1956
|
+
});
|
|
1897
1957
|
// 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
|
|
1898
1958
|
// Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
|
|
1899
1959
|
const executeWhenIdleBatched = fn => {
|
|
1900
1960
|
if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
|
|
1961
|
+
if ($5vyXB$solidjs.untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately
|
|
1901
1962
|
const existingStack = listingContext?.[$19950faaac026e09$var$onIdleFunctionsSymbol];
|
|
1902
1963
|
if (existingStack) return existingStack.add(fn);
|
|
1903
1964
|
const newStack = new Set([fn]);
|
|
1904
1965
|
if (listingContext) listingContext[$19950faaac026e09$var$onIdleFunctionsSymbol] = newStack;
|
|
1905
|
-
const processStackWhenIdle = () =>
|
|
1966
|
+
const processStackWhenIdle = () => $3ea8e0af95b5b7d2$export$2972b890694ced75($5vyXB$depictaiutilishared.catchify(deadline => {
|
|
1906
1967
|
const start = performance.now();
|
|
1907
1968
|
const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
|
|
1908
1969
|
for (const fn of newStack) {
|
|
@@ -1917,7 +1978,7 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
1917
1978
|
}
|
|
1918
1979
|
// Stack is empty
|
|
1919
1980
|
if (listingContext) delete listingContext[$19950faaac026e09$var$onIdleFunctionsSymbol];
|
|
1920
|
-
}, {
|
|
1981
|
+
}), {
|
|
1921
1982
|
timeout: 15000
|
|
1922
1983
|
} // 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
|
|
1923
1984
|
);
|
|
@@ -1931,7 +1992,8 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
1931
1992
|
img.classList.add("s-responsive-image");
|
|
1932
1993
|
if (listingContext) {
|
|
1933
1994
|
let prevValue;
|
|
1934
|
-
const aspectRatios = listingContext[$19950faaac026e09$export$f8945274f08a3105] ||= new (
|
|
1995
|
+
const aspectRatios = listingContext[$19950faaac026e09$export$f8945274f08a3105] ||= new Set();
|
|
1996
|
+
const [, setMostPrevalentAspectRatio] = listingContext[$19950faaac026e09$export$6066eb417ed2e9f7] ||= $5vyXB$solidjs.createSignal();
|
|
1935
1997
|
img.addEventListener("load", $5vyXB$depictaiutilishared.catchify(() => {
|
|
1936
1998
|
// Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2
|
|
1937
1999
|
const aspectRatio_ = img.naturalWidth / img.naturalHeight;
|
|
@@ -1941,13 +2003,19 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
1941
2003
|
} : undefined;
|
|
1942
2004
|
if (newValue) aspectRatios.add(newValue);
|
|
1943
2005
|
prevValue = newValue;
|
|
2006
|
+
// Do all calculations resulting of an update directly, for performance
|
|
2007
|
+
const asArray = [...aspectRatios].map(({
|
|
2008
|
+
aspectRatio_: aspectRatio_
|
|
2009
|
+
}) => aspectRatio_);
|
|
2010
|
+
const mostPrevalentAspectRatio = $5vyXB$depictaiutilishared.findMostFrequentItem(asArray);
|
|
2011
|
+
setMostPrevalentAspectRatio(mostPrevalentAspectRatio);
|
|
1944
2012
|
}));
|
|
1945
2013
|
$5vyXB$solidjs.onCleanup(() => prevValue && aspectRatios.delete(prevValue));
|
|
1946
2014
|
}
|
|
1947
2015
|
$5vyXB$solidjs.onCleanup(() => gotCleanedUp = true);
|
|
1948
|
-
$5vyXB$solidjsweb.spread(img, $5vyXB$solidjs.mergeProps(
|
|
2016
|
+
$5vyXB$solidjsweb.spread(img, $5vyXB$solidjs.mergeProps(modifiedOtherAttributes), false, true);
|
|
1949
2017
|
$5vyXB$solidjs.createEffect(() => {
|
|
1950
|
-
if (!props.size()) return; // wait until we have a size
|
|
2018
|
+
if (!props.size()) return; // wait until we have a size, run every time the size changes
|
|
1951
2019
|
if (timeoutSet) return;
|
|
1952
2020
|
const handler = $5vyXB$depictaiutilishared.catchify(() => {
|
|
1953
2021
|
if (gotCleanedUp) return;
|
|
@@ -1972,7 +2040,7 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
1972
2040
|
// We can do this because there has to be a container around us giving us a size
|
|
1973
2041
|
// No need to listen if we're already in the DOM
|
|
1974
2042
|
if (hasDecodedFastPath) return;
|
|
1975
|
-
if (
|
|
2043
|
+
if (shouldActuallyEnableLazyLoading()) {
|
|
1976
2044
|
// For lazy loading there's no decoding to wait for as it only occurs when the image is visible
|
|
1977
2045
|
// Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
|
|
1978
2046
|
setHasDecoded(true);
|
|
@@ -1999,9 +2067,10 @@ function $19950faaac026e09$var$make_srcset(url, resolutions) {
|
|
|
1999
2067
|
return resolutions.map(width => `${$19950faaac026e09$var$generateImageUrl(url, width)} ${width}w`).join(", ");
|
|
2000
2068
|
}
|
|
2001
2069
|
function $19950faaac026e09$var$generateImageUrl(url, width) {
|
|
2002
|
-
//
|
|
2003
|
-
url
|
|
2004
|
-
|
|
2070
|
+
// 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)
|
|
2071
|
+
// 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)
|
|
2072
|
+
// That way we can just to string concatenation which is insanely fast
|
|
2073
|
+
return url + "&width=" + encodeURIComponent(width);
|
|
2005
2074
|
}
|
|
2006
2075
|
const $a33065cfed827fc0$var$backupSizeSignal = /*@__PURE__*/$5vyXB$solidjs.createSignal();
|
|
2007
2076
|
const $a33065cfed827fc0$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
|
|
@@ -2011,40 +2080,25 @@ function $a33065cfed827fc0$export$e4b984597b71e989(props) {
|
|
|
2011
2080
|
// create a signal that's the same for all items in this listing
|
|
2012
2081
|
context[$a33065cfed827fc0$export$d7b7ab832c20e2f4] = $5vyXB$solidjs.createSignal();
|
|
2013
2082
|
const [currentImageSize, setCurrentImageSize] = context?.[$a33065cfed827fc0$export$d7b7ab832c20e2f4] || $a33065cfed827fc0$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
|
|
2014
|
-
const
|
|
2015
|
-
// If the context exists we have to create the
|
|
2016
|
-
context[(0, $19950faaac026e09$export$
|
|
2017
|
-
const
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
const aspectRatioToUse = $5vyXB$solidjs.createMemo(() => {
|
|
2021
|
-
const aspectRatiosSet = aspectRatios(); // This signal "changes" to the same set every time the set changes, so we can use it as a dependency here
|
|
2022
|
-
useMostPrevalentAspectRatio: {
|
|
2023
|
-
if (!aspectRatiosSet || !props.autoAdjustAspectRatio) break useMostPrevalentAspectRatio;
|
|
2024
|
-
// Get the aspect ratio that most of the loaded images inside the ListingProvider we are, load
|
|
2025
|
-
const asArray = [...aspectRatiosSet].map(({
|
|
2026
|
-
aspectRatio_: aspectRatio_
|
|
2027
|
-
}) => aspectRatio_);
|
|
2028
|
-
const mostPrevalentAspectRatio = $5vyXB$depictaiutilishared.findMostFrequentItem(asArray);
|
|
2029
|
-
if (mostPrevalentAspectRatio) return `var(${(0, $6f604560873e4f69$export$8a2234b5b1a5ebd4)}, ${mostPrevalentAspectRatio})`;
|
|
2030
|
-
}
|
|
2031
|
-
return props.aspectRatio;
|
|
2032
|
-
});
|
|
2033
|
-
const container = $5vyXB$solidjsweb.createComponent((0, $93304d59a9747aa6$export$94026ee33dbabc26), {
|
|
2034
|
-
get aspectRatio() {
|
|
2035
|
-
return aspectRatioToUse();
|
|
2036
|
-
},
|
|
2037
|
-
get ["class"]() {
|
|
2083
|
+
const [mostPrevalentAspectRatio] = context ?
|
|
2084
|
+
// 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
|
|
2085
|
+
context[(0, $19950faaac026e09$export$6066eb417ed2e9f7)] ||= $5vyXB$solidjs.createSignal() : [];
|
|
2086
|
+
const container = $93304d59a9747aa6$export$94026ee33dbabc26({
|
|
2087
|
+
// Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
|
|
2088
|
+
get class() {
|
|
2038
2089
|
return props.class;
|
|
2090
|
+
},
|
|
2091
|
+
get aspectRatio() {
|
|
2092
|
+
if (props.autoAdjustAspectRatio) {
|
|
2093
|
+
const targetRatio = mostPrevalentAspectRatio?.();
|
|
2094
|
+
if (targetRatio != undefined) return `var(${(0, $6f604560873e4f69$export$8a2234b5b1a5ebd4)}, ${targetRatio})`;
|
|
2095
|
+
}
|
|
2096
|
+
return props.aspectRatio;
|
|
2039
2097
|
}
|
|
2040
2098
|
});
|
|
2041
2099
|
const owner = $5vyXB$solidjs.getOwner();
|
|
2042
2100
|
let createdSizeAccessor = false;
|
|
2043
2101
|
let wasCleanedUp = false;
|
|
2044
|
-
for (const event of ["add", "delete"]) {
|
|
2045
|
-
aspectRatiosSet?.addEventListener(event, () => setAspectRatios(aspectRatiosSet));
|
|
2046
|
-
$5vyXB$solidjs.onCleanup(() => aspectRatiosSet?.removeEventListener(event, () => setAspectRatios(aspectRatiosSet)));
|
|
2047
|
-
}
|
|
2048
2102
|
$5vyXB$solidjs.createEffect(() => {
|
|
2049
2103
|
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
2050
2104
|
// ensure we always have a size accessor
|