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