@depict-ai/ui 4.0.6 → 4.0.8
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 +106 -45
- package/ES10/index.d.ts +15 -2
- package/ES10/index.js +110 -51
- package/latest/index.cjs +104 -44
- package/latest/index.d.ts +15 -2
- package/latest/index.js +108 -50
- package/package.json +1 -1
- package/server/ES10/index.cjs +106 -45
- package/server/ES10/index.d.ts +15 -2
- package/server/ES10/index.js +110 -51
- package/server/latest/index.cjs +104 -44
- package/server/latest/index.d.ts +15 -2
- package/server/latest/index.js +108 -50
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,
|
|
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, mergeProps as $b8hua$mergeProps1, createUniqueId as $b8hua$createUniqueId, createRenderEffect as $b8hua$createRenderEffect, createSelector as $b8hua$createSelector, children as $b8hua$children, splitProps as $b8hua$splitProps, 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.8";
|
|
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,6 +1935,7 @@ 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
1940
|
// Enable reactive props
|
|
1884
1941
|
const otherOptions = $b8hua$createMemo(() => {
|
|
@@ -1893,9 +1950,8 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1893
1950
|
return cloned_props;
|
|
1894
1951
|
});
|
|
1895
1952
|
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]);
|
|
1953
|
+
const fallback_src = $56047603f9d212b6$var$generateImageUrl(props.src, 400);
|
|
1954
|
+
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
1955
|
// The order here *might* matter - I've seen mobile safari always start with loading the 400px version when it was reversed
|
|
1900
1956
|
return {
|
|
1901
1957
|
srcset: srcset,
|
|
@@ -1906,17 +1962,27 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1906
1962
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
1907
1963
|
const [hasSetSize, setHasSetSize] = $b8hua$createSignal(false);
|
|
1908
1964
|
const [hasDecoded, setHasDecoded] = $b8hua$createSignal(false);
|
|
1965
|
+
const productCardIndexAccessor = $1e69163caedaab4e$export$e3faf4d95300054f();
|
|
1909
1966
|
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
1967
|
const listingContext = $5441862cd2f5e111$export$8d0c4fdbb05a2f2e();
|
|
1968
|
+
const isPrioritisedImage = $b8hua$createMemo(() => (productCardIndexAccessor === null || productCardIndexAccessor === void 0 ? void 0 : productCardIndexAccessor()) < 8);
|
|
1969
|
+
const loadLazily = $b8hua$createMemo(() => {
|
|
1970
|
+
const {
|
|
1971
|
+
loading: loading
|
|
1972
|
+
} = props;
|
|
1973
|
+
if (loading === "force-lazy") return true;
|
|
1974
|
+
return loading === "lazy" && !isPrioritisedImage();
|
|
1975
|
+
});
|
|
1911
1976
|
// 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
1977
|
// Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
|
|
1913
1978
|
const executeWhenIdleBatched = fn => {
|
|
1914
1979
|
if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
|
|
1980
|
+
if ($b8hua$untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately
|
|
1915
1981
|
const existingStack = listingContext === null || listingContext === void 0 ? void 0 : listingContext[$56047603f9d212b6$var$onIdleFunctionsSymbol];
|
|
1916
1982
|
if (existingStack) return existingStack.add(fn);
|
|
1917
1983
|
const newStack = new Set([fn]);
|
|
1918
1984
|
if (listingContext) listingContext[$56047603f9d212b6$var$onIdleFunctionsSymbol] = newStack;
|
|
1919
|
-
const processStackWhenIdle = () =>
|
|
1985
|
+
const processStackWhenIdle = () => $6db93f70c2db1486$export$2972b890694ced75($b8hua$catchify(deadline => {
|
|
1920
1986
|
const start = performance.now();
|
|
1921
1987
|
const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
|
|
1922
1988
|
for (const fn of newStack) {
|
|
@@ -1931,7 +1997,7 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1931
1997
|
}
|
|
1932
1998
|
// Stack is empty
|
|
1933
1999
|
if (listingContext) delete listingContext[$56047603f9d212b6$var$onIdleFunctionsSymbol];
|
|
1934
|
-
}, {
|
|
2000
|
+
}), {
|
|
1935
2001
|
timeout: 15000
|
|
1936
2002
|
} // 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
2003
|
);
|
|
@@ -1945,7 +2011,8 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1945
2011
|
img.classList.add("s-responsive-image");
|
|
1946
2012
|
if (listingContext) {
|
|
1947
2013
|
let prevValue;
|
|
1948
|
-
const aspectRatios = listingContext[$56047603f9d212b6$export$f8945274f08a3105] || (listingContext[$56047603f9d212b6$export$f8945274f08a3105] = new (
|
|
2014
|
+
const aspectRatios = listingContext[$56047603f9d212b6$export$f8945274f08a3105] || (listingContext[$56047603f9d212b6$export$f8945274f08a3105] = new Set());
|
|
2015
|
+
const [, setMostPrevalentAspectRatio] = listingContext[$56047603f9d212b6$export$6066eb417ed2e9f7] || (listingContext[$56047603f9d212b6$export$6066eb417ed2e9f7] = $b8hua$createSignal());
|
|
1949
2016
|
img.addEventListener("load", $b8hua$catchify(() => {
|
|
1950
2017
|
// Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2
|
|
1951
2018
|
const aspectRatio_ = img.naturalWidth / img.naturalHeight;
|
|
@@ -1955,13 +2022,22 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1955
2022
|
} : undefined;
|
|
1956
2023
|
if (newValue) aspectRatios.add(newValue);
|
|
1957
2024
|
prevValue = newValue;
|
|
2025
|
+
// Do all calculations resulting of an update directly, for performance
|
|
2026
|
+
const asArray = [...aspectRatios].map(_ref2 => {
|
|
2027
|
+
let {
|
|
2028
|
+
aspectRatio_: aspectRatio_
|
|
2029
|
+
} = _ref2;
|
|
2030
|
+
return aspectRatio_;
|
|
2031
|
+
});
|
|
2032
|
+
const mostPrevalentAspectRatio = $b8hua$findMostFrequentItem(asArray);
|
|
2033
|
+
setMostPrevalentAspectRatio(mostPrevalentAspectRatio);
|
|
1958
2034
|
}));
|
|
1959
2035
|
$b8hua$onCleanup(() => prevValue && aspectRatios.delete(prevValue));
|
|
1960
2036
|
}
|
|
1961
2037
|
$b8hua$onCleanup(() => gotCleanedUp = true);
|
|
1962
2038
|
$b8hua$spread(img, $b8hua$mergeProps1(otherOptions), false, true);
|
|
1963
2039
|
$b8hua$createEffect(() => {
|
|
1964
|
-
if (!props.size()) return; // wait until we have a size
|
|
2040
|
+
if (!props.size()) return; // wait until we have a size, run every time the size changes
|
|
1965
2041
|
if (timeoutSet) return;
|
|
1966
2042
|
const handler = $b8hua$catchify(() => {
|
|
1967
2043
|
if (gotCleanedUp) return;
|
|
@@ -1986,7 +2062,7 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1986
2062
|
// We can do this because there has to be a container around us giving us a size
|
|
1987
2063
|
// No need to listen if we're already in the DOM
|
|
1988
2064
|
if (hasDecodedFastPath) return;
|
|
1989
|
-
if (
|
|
2065
|
+
if (loadLazily()) {
|
|
1990
2066
|
// For lazy loading there's no decoding to wait for as it only occurs when the image is visible
|
|
1991
2067
|
// Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
|
|
1992
2068
|
setHasDecoded(true);
|
|
@@ -2013,9 +2089,10 @@ function $56047603f9d212b6$var$make_srcset(url, resolutions) {
|
|
|
2013
2089
|
return resolutions.map(width => "".concat($56047603f9d212b6$var$generateImageUrl(url, width), " ").concat(width, "w")).join(", ");
|
|
2014
2090
|
}
|
|
2015
2091
|
function $56047603f9d212b6$var$generateImageUrl(url, width) {
|
|
2016
|
-
//
|
|
2017
|
-
url
|
|
2018
|
-
|
|
2092
|
+
// 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)
|
|
2093
|
+
// 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)
|
|
2094
|
+
// That way we can just to string concatenation which is insanely fast
|
|
2095
|
+
return url + "&width=" + encodeURIComponent(width);
|
|
2019
2096
|
}
|
|
2020
2097
|
const $4df489344a0f97c7$var$backupSizeSignal = /*@__PURE__*/$b8hua$createSignal();
|
|
2021
2098
|
const $4df489344a0f97c7$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
|
|
@@ -2025,41 +2102,23 @@ function $4df489344a0f97c7$export$e4b984597b71e989(props) {
|
|
|
2025
2102
|
// create a signal that's the same for all items in this listing
|
|
2026
2103
|
context[$4df489344a0f97c7$export$d7b7ab832c20e2f4] = $b8hua$createSignal();
|
|
2027
2104
|
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"]() {
|
|
2105
|
+
const [mostPrevalentAspectRatio] = context ? context[(0, $56047603f9d212b6$export$6066eb417ed2e9f7)] || (context[(0, $56047603f9d212b6$export$6066eb417ed2e9f7)] = $b8hua$createSignal()) : [];
|
|
2106
|
+
const container = $801e8845d3fa3653$export$94026ee33dbabc26({
|
|
2107
|
+
// Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
|
|
2108
|
+
get class() {
|
|
2053
2109
|
return props.class;
|
|
2110
|
+
},
|
|
2111
|
+
get aspectRatio() {
|
|
2112
|
+
if (props.autoAdjustAspectRatio) {
|
|
2113
|
+
const targetRatio = mostPrevalentAspectRatio === null || mostPrevalentAspectRatio === void 0 ? void 0 : mostPrevalentAspectRatio();
|
|
2114
|
+
if (targetRatio != undefined) return "var(".concat((0, $5eaa00b951637e96$export$8a2234b5b1a5ebd4), ", ").concat(targetRatio, ")");
|
|
2115
|
+
}
|
|
2116
|
+
return props.aspectRatio;
|
|
2054
2117
|
}
|
|
2055
2118
|
});
|
|
2056
2119
|
const owner = $b8hua$getOwner();
|
|
2057
2120
|
let createdSizeAccessor = false;
|
|
2058
2121
|
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
2122
|
$b8hua$createEffect(() => {
|
|
2064
2123
|
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
2065
2124
|
// ensure we always have a size accessor
|
|
@@ -3032,7 +3091,7 @@ const $6a439680ae7e9ba3$var$TabsContext = /*@__PURE__*/$b8hua$createContext();
|
|
|
3032
3091
|
const $6a439680ae7e9ba3$var$useTabs = () => $b8hua$useContext($6a439680ae7e9ba3$var$TabsContext);
|
|
3033
3092
|
function $6a439680ae7e9ba3$export$b2539bed5023c21c(props) {
|
|
3034
3093
|
return $b8hua$createComponent($6a439680ae7e9ba3$var$TabsContext.Provider, {
|
|
3035
|
-
value: new (0, $b8hua$
|
|
3094
|
+
value: new (0, $b8hua$ListenableSet)(),
|
|
3036
3095
|
get children() {
|
|
3037
3096
|
return $b8hua$createComponent($6a439680ae7e9ba3$var$ActualTabs, $b8hua$mergeProps(props, {
|
|
3038
3097
|
get children() {
|
|
@@ -4790,7 +4849,7 @@ function $1e7465a8ffa97f6c$export$e0d834a0ad870cda(_ref) {
|
|
|
4790
4849
|
$b8hua$createComputed(() => {
|
|
4791
4850
|
var _selected_filter;
|
|
4792
4851
|
const defined_filter_data = (_selected_filter = selected_filter()) === null || _selected_filter === void 0 ? void 0 : _selected_filter.data;
|
|
4793
|
-
const default_data =
|
|
4852
|
+
const default_data = defaultRange();
|
|
4794
4853
|
if (Array.isArray(defined_filter_data)) current_range[1](defined_filter_data);else current_range[1](default_data);
|
|
4795
4854
|
});
|
|
4796
4855
|
$b8hua$createComputed(() => {
|
|
@@ -10960,7 +11019,7 @@ function $d53ebed6f63304e4$export$6d0c9c22f6652669(_ref) {
|
|
|
10960
11019
|
number_: num_results,
|
|
10961
11020
|
i18n_: i18n_
|
|
10962
11021
|
});
|
|
10963
|
-
const queries_without_content_results_ = new (0, $b8hua$
|
|
11022
|
+
const queries_without_content_results_ = new (0, $b8hua$ListenableSet1)();
|
|
10964
11023
|
const [check_query, set_check_query] = $b8hua$createSignal(false);
|
|
10965
11024
|
const placeholders_enabled = $b8hua$createMemo(() => {
|
|
10966
11025
|
// don't show placeholders when the user toggles filters
|
|
@@ -12617,4 +12676,4 @@ function $a3026fb727bc7550$var$align_field_modal(alignmentSignals, input, modalV
|
|
|
12617
12676
|
});
|
|
12618
12677
|
}
|
|
12619
12678
|
$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 };
|
|
12679
|
+
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.8";
|
|
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,6 +1922,7 @@ 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
1927
|
// Enable reactive props
|
|
1870
1928
|
const otherOptions = $5vyXB$solidjs.createMemo(() => {
|
|
@@ -1879,9 +1937,8 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
1879
1937
|
return cloned_props;
|
|
1880
1938
|
});
|
|
1881
1939
|
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]);
|
|
1940
|
+
const fallback_src = $19950faaac026e09$var$generateImageUrl(props.src, 400);
|
|
1941
|
+
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
1942
|
// The order here *might* matter - I've seen mobile safari always start with loading the 400px version when it was reversed
|
|
1886
1943
|
return {
|
|
1887
1944
|
srcset: srcset,
|
|
@@ -1892,17 +1949,27 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
1892
1949
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
1893
1950
|
const [hasSetSize, setHasSetSize] = $5vyXB$solidjs.createSignal(false);
|
|
1894
1951
|
const [hasDecoded, setHasDecoded] = $5vyXB$solidjs.createSignal(false);
|
|
1952
|
+
const productCardIndexAccessor = $129b9b9c010039d0$export$e3faf4d95300054f();
|
|
1895
1953
|
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
1954
|
const listingContext = $84798aaa863a4909$export$8d0c4fdbb05a2f2e();
|
|
1955
|
+
const isPrioritisedImage = $5vyXB$solidjs.createMemo(() => productCardIndexAccessor?.() < 8);
|
|
1956
|
+
const loadLazily = $5vyXB$solidjs.createMemo(() => {
|
|
1957
|
+
const {
|
|
1958
|
+
loading: loading
|
|
1959
|
+
} = props;
|
|
1960
|
+
if (loading === "force-lazy") return true;
|
|
1961
|
+
return loading === "lazy" && !isPrioritisedImage();
|
|
1962
|
+
});
|
|
1897
1963
|
// 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
1964
|
// Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
|
|
1899
1965
|
const executeWhenIdleBatched = fn => {
|
|
1900
1966
|
if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
|
|
1967
|
+
if ($5vyXB$solidjs.untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately
|
|
1901
1968
|
const existingStack = listingContext?.[$19950faaac026e09$var$onIdleFunctionsSymbol];
|
|
1902
1969
|
if (existingStack) return existingStack.add(fn);
|
|
1903
1970
|
const newStack = new Set([fn]);
|
|
1904
1971
|
if (listingContext) listingContext[$19950faaac026e09$var$onIdleFunctionsSymbol] = newStack;
|
|
1905
|
-
const processStackWhenIdle = () =>
|
|
1972
|
+
const processStackWhenIdle = () => $3ea8e0af95b5b7d2$export$2972b890694ced75($5vyXB$depictaiutilishared.catchify(deadline => {
|
|
1906
1973
|
const start = performance.now();
|
|
1907
1974
|
const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
|
|
1908
1975
|
for (const fn of newStack) {
|
|
@@ -1917,7 +1984,7 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
1917
1984
|
}
|
|
1918
1985
|
// Stack is empty
|
|
1919
1986
|
if (listingContext) delete listingContext[$19950faaac026e09$var$onIdleFunctionsSymbol];
|
|
1920
|
-
}, {
|
|
1987
|
+
}), {
|
|
1921
1988
|
timeout: 15000
|
|
1922
1989
|
} // 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
1990
|
);
|
|
@@ -1931,7 +1998,8 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
1931
1998
|
img.classList.add("s-responsive-image");
|
|
1932
1999
|
if (listingContext) {
|
|
1933
2000
|
let prevValue;
|
|
1934
|
-
const aspectRatios = listingContext[$19950faaac026e09$export$f8945274f08a3105] ||= new (
|
|
2001
|
+
const aspectRatios = listingContext[$19950faaac026e09$export$f8945274f08a3105] ||= new Set();
|
|
2002
|
+
const [, setMostPrevalentAspectRatio] = listingContext[$19950faaac026e09$export$6066eb417ed2e9f7] ||= $5vyXB$solidjs.createSignal();
|
|
1935
2003
|
img.addEventListener("load", $5vyXB$depictaiutilishared.catchify(() => {
|
|
1936
2004
|
// Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2
|
|
1937
2005
|
const aspectRatio_ = img.naturalWidth / img.naturalHeight;
|
|
@@ -1941,13 +2009,19 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
1941
2009
|
} : undefined;
|
|
1942
2010
|
if (newValue) aspectRatios.add(newValue);
|
|
1943
2011
|
prevValue = newValue;
|
|
2012
|
+
// Do all calculations resulting of an update directly, for performance
|
|
2013
|
+
const asArray = [...aspectRatios].map(({
|
|
2014
|
+
aspectRatio_: aspectRatio_
|
|
2015
|
+
}) => aspectRatio_);
|
|
2016
|
+
const mostPrevalentAspectRatio = $5vyXB$depictaiutilishared.findMostFrequentItem(asArray);
|
|
2017
|
+
setMostPrevalentAspectRatio(mostPrevalentAspectRatio);
|
|
1944
2018
|
}));
|
|
1945
2019
|
$5vyXB$solidjs.onCleanup(() => prevValue && aspectRatios.delete(prevValue));
|
|
1946
2020
|
}
|
|
1947
2021
|
$5vyXB$solidjs.onCleanup(() => gotCleanedUp = true);
|
|
1948
2022
|
$5vyXB$solidjsweb.spread(img, $5vyXB$solidjs.mergeProps(otherOptions), false, true);
|
|
1949
2023
|
$5vyXB$solidjs.createEffect(() => {
|
|
1950
|
-
if (!props.size()) return; // wait until we have a size
|
|
2024
|
+
if (!props.size()) return; // wait until we have a size, run every time the size changes
|
|
1951
2025
|
if (timeoutSet) return;
|
|
1952
2026
|
const handler = $5vyXB$depictaiutilishared.catchify(() => {
|
|
1953
2027
|
if (gotCleanedUp) return;
|
|
@@ -1972,7 +2046,7 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
1972
2046
|
// We can do this because there has to be a container around us giving us a size
|
|
1973
2047
|
// No need to listen if we're already in the DOM
|
|
1974
2048
|
if (hasDecodedFastPath) return;
|
|
1975
|
-
if (
|
|
2049
|
+
if (loadLazily()) {
|
|
1976
2050
|
// For lazy loading there's no decoding to wait for as it only occurs when the image is visible
|
|
1977
2051
|
// Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
|
|
1978
2052
|
setHasDecoded(true);
|
|
@@ -1999,9 +2073,10 @@ function $19950faaac026e09$var$make_srcset(url, resolutions) {
|
|
|
1999
2073
|
return resolutions.map(width => `${$19950faaac026e09$var$generateImageUrl(url, width)} ${width}w`).join(", ");
|
|
2000
2074
|
}
|
|
2001
2075
|
function $19950faaac026e09$var$generateImageUrl(url, width) {
|
|
2002
|
-
//
|
|
2003
|
-
url
|
|
2004
|
-
|
|
2076
|
+
// 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)
|
|
2077
|
+
// 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)
|
|
2078
|
+
// That way we can just to string concatenation which is insanely fast
|
|
2079
|
+
return url + "&width=" + encodeURIComponent(width);
|
|
2005
2080
|
}
|
|
2006
2081
|
const $a33065cfed827fc0$var$backupSizeSignal = /*@__PURE__*/$5vyXB$solidjs.createSignal();
|
|
2007
2082
|
const $a33065cfed827fc0$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
|
|
@@ -2011,40 +2086,25 @@ function $a33065cfed827fc0$export$e4b984597b71e989(props) {
|
|
|
2011
2086
|
// create a signal that's the same for all items in this listing
|
|
2012
2087
|
context[$a33065cfed827fc0$export$d7b7ab832c20e2f4] = $5vyXB$solidjs.createSignal();
|
|
2013
2088
|
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"]() {
|
|
2089
|
+
const [mostPrevalentAspectRatio] = context ?
|
|
2090
|
+
// 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
|
|
2091
|
+
context[(0, $19950faaac026e09$export$6066eb417ed2e9f7)] ||= $5vyXB$solidjs.createSignal() : [];
|
|
2092
|
+
const container = $93304d59a9747aa6$export$94026ee33dbabc26({
|
|
2093
|
+
// Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
|
|
2094
|
+
get class() {
|
|
2038
2095
|
return props.class;
|
|
2096
|
+
},
|
|
2097
|
+
get aspectRatio() {
|
|
2098
|
+
if (props.autoAdjustAspectRatio) {
|
|
2099
|
+
const targetRatio = mostPrevalentAspectRatio?.();
|
|
2100
|
+
if (targetRatio != undefined) return `var(${(0, $6f604560873e4f69$export$8a2234b5b1a5ebd4)}, ${targetRatio})`;
|
|
2101
|
+
}
|
|
2102
|
+
return props.aspectRatio;
|
|
2039
2103
|
}
|
|
2040
2104
|
});
|
|
2041
2105
|
const owner = $5vyXB$solidjs.getOwner();
|
|
2042
2106
|
let createdSizeAccessor = false;
|
|
2043
2107
|
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
2108
|
$5vyXB$solidjs.createEffect(() => {
|
|
2049
2109
|
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
2050
2110
|
// ensure we always have a size accessor
|
|
@@ -4612,7 +4672,7 @@ function $0b7222ba8a8bb72f$export$e0d834a0ad870cda({
|
|
|
4612
4672
|
$5vyXB$solidjs.onCleanup(() => clearTimeout(debounce_timeout));
|
|
4613
4673
|
$5vyXB$solidjs.createComputed(() => {
|
|
4614
4674
|
const defined_filter_data = selected_filter()?.data;
|
|
4615
|
-
const default_data =
|
|
4675
|
+
const default_data = defaultRange();
|
|
4616
4676
|
if (Array.isArray(defined_filter_data)) current_range[1](defined_filter_data);else current_range[1](default_data);
|
|
4617
4677
|
});
|
|
4618
4678
|
$5vyXB$solidjs.createComputed(() => {
|