@depict-ai/ui 4.7.7 → 4.7.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 +127 -107
- package/ES10/index.d.ts +6 -6
- package/ES10/index.js +128 -108
- package/latest/index.cjs +117 -94
- package/latest/index.d.ts +6 -6
- package/latest/index.js +118 -95
- package/package.json +4 -4
- package/server/ES10/index.cjs +58 -58
- package/server/ES10/index.d.ts +6 -6
- package/server/ES10/index.js +58 -58
- package/server/latest/index.cjs +54 -54
- package/server/latest/index.d.ts +6 -6
- package/server/latest/index.js +54 -54
package/server/latest/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { createStore as $i7OB2$createStore, reconcile as $i7OB2$reconcile } from
|
|
|
7
7
|
/*! Depict.ai search and product listing SDK */
|
|
8
8
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
9
9
|
register_es_version("ui", "latest");
|
|
10
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "4.7.
|
|
10
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "4.7.8";
|
|
11
11
|
function $24e27fab9c821b86$export$5bad61ecde080b1f(...params) {
|
|
12
12
|
const {
|
|
13
13
|
collapse: collapse,
|
|
@@ -774,34 +774,6 @@ function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
|
|
|
774
774
|
}) => signal[1](matches)).remove);
|
|
775
775
|
return signal[0];
|
|
776
776
|
}
|
|
777
|
-
|
|
778
|
-
/** @jsxImportSource solid-js */
|
|
779
|
-
|
|
780
|
-
function $2449872a62a75a20$export$ebdc3711f7e02ccd(what_to_watch) {
|
|
781
|
-
const [width, setWidth] = $i7OB2$createSignal();
|
|
782
|
-
const resizeObserver = new ResizeObserver($i7OB2$catchify(records => {
|
|
783
|
-
for (let j = 0; j < records.length; j++) {
|
|
784
|
-
const width = records[j].borderBoxSize?.[0]?.inlineSize ?? what_to_watch.getBoundingClientRect().width;
|
|
785
|
-
setWidth(width);
|
|
786
|
-
}
|
|
787
|
-
}));
|
|
788
|
-
// If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
|
|
789
|
-
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
790
|
-
const disconnect = (0, $i7OB2$observer).onexists(what_to_watch, ({
|
|
791
|
-
element: element
|
|
792
|
-
}) => requestAnimationFrame($i7OB2$catchify(() => {
|
|
793
|
-
const current_size = what_to_watch.getBoundingClientRect().width;
|
|
794
|
-
if (current_size)
|
|
795
|
-
// If element has size, set signal to that. ResizeObserver only triggers when the content is visible in some cases, but it might already have a size. This reduces size filter expanding animation jank in chrome.
|
|
796
|
-
setWidth(current_size);
|
|
797
|
-
resizeObserver.observe(element);
|
|
798
|
-
})));
|
|
799
|
-
$i7OB2$onCleanup(() => {
|
|
800
|
-
resizeObserver.disconnect();
|
|
801
|
-
disconnect();
|
|
802
|
-
});
|
|
803
|
-
return width;
|
|
804
|
-
}
|
|
805
777
|
function $d134eae24341b4a1$export$89c6019e4baa40b1(props) {
|
|
806
778
|
const style = $i7OB2$createMemo(() => {
|
|
807
779
|
const {
|
|
@@ -936,9 +908,10 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
|
|
|
936
908
|
});
|
|
937
909
|
// 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
|
|
938
910
|
// Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
|
|
939
|
-
const executeWhenIdleBatched = fn => {
|
|
911
|
+
const executeWhenIdleBatched = (fn, isSizesUpdate) => {
|
|
940
912
|
if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
|
|
941
|
-
if ($i7OB2$untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately
|
|
913
|
+
if ((!isSizesUpdate || !sizeSetFastPath) && $i7OB2$untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately (improves lighthouse metrics)
|
|
914
|
+
// unless we're just a `sizes` update after the initial sizes setting (this optimisation makes the looks animation a lot smoother on low-cpu devices)
|
|
942
915
|
const existingStack = listingContext?.[$e8ffe11ed01df0fe$var$onIdleFunctionsSymbol];
|
|
943
916
|
if (existingStack) return existingStack.add(fn);
|
|
944
917
|
const newStack = new Set([fn]);
|
|
@@ -1020,10 +993,11 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
|
|
|
1020
993
|
// This greatly improves performance when loading (more) products
|
|
1021
994
|
// See https://depictaiworkspace.slack.com/archives/C05NJ0K3WRL/p1698220617663139
|
|
1022
995
|
timeoutSet = true; // Important to set timeoutSet before the call to executeWhenIdleBatched since if this is an important image executeWhenIdleBatched will execute fn immediately
|
|
1023
|
-
executeWhenIdleBatched(handler);
|
|
996
|
+
executeWhenIdleBatched(handler, true);
|
|
1024
997
|
});
|
|
998
|
+
const dontLoadImageYet = $i7OB2$createMemo(() => !props.size() || !hasSetSize()); // Moving this condition into a memo saves us from re-setting src and srcset (expensive) if just props.size changes
|
|
1025
999
|
$i7OB2$createEffect(() => {
|
|
1026
|
-
if (
|
|
1000
|
+
if (dontLoadImageYet()) return; // If size isn't known or set, don't assign src yet since it would cause the most low res image to load
|
|
1027
1001
|
Object.assign(img, src_options());
|
|
1028
1002
|
// Add to DOM once decoded to not require/block any paints before image has completed loading and avoid showing broken image symbol
|
|
1029
1003
|
// We can do this because there has to be a container around us giving us a size
|
|
@@ -1039,7 +1013,7 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
|
|
|
1039
1013
|
img.decode().catch(e => $i7OB2$dwarn("Failed to decode image", e, img)) // Display the image also if loading failed so webdev can debug and doesn't get "no image"
|
|
1040
1014
|
.then(async () => {
|
|
1041
1015
|
// Also wait with inserting image (i.e. paint) until browser is idle
|
|
1042
|
-
await new Promise(r => executeWhenIdleBatched(r));
|
|
1016
|
+
await new Promise(r => executeWhenIdleBatched(r, false));
|
|
1043
1017
|
if (gotCleanedUp) return;
|
|
1044
1018
|
setHasDecoded(true);
|
|
1045
1019
|
hasDecodedFastPath = true;
|
|
@@ -1294,7 +1268,7 @@ var $62a8f670f8464532$var$_tmpl$ = ["<div", ' style="position:absolute;width:10p
|
|
|
1294
1268
|
let $62a8f670f8464532$var$cachedValue;
|
|
1295
1269
|
async function $62a8f670f8464532$export$7b9a0e99f0aeb2f3() {
|
|
1296
1270
|
if ($62a8f670f8464532$var$cachedValue != undefined) return $62a8f670f8464532$var$cachedValue;
|
|
1297
|
-
return $62a8f670f8464532$var$cachedValue =
|
|
1271
|
+
return $62a8f670f8464532$var$cachedValue = $62a8f670f8464532$var$checkIfIsAffectedByChromeBug326498383();
|
|
1298
1272
|
}
|
|
1299
1273
|
async function $62a8f670f8464532$var$checkIfIsAffectedByChromeBug326498383() {
|
|
1300
1274
|
let isAffected = true;
|
|
@@ -1307,7 +1281,7 @@ async function $62a8f670f8464532$var$checkIfIsAffectedByChromeBug326498383() {
|
|
|
1307
1281
|
setTimeout($i7OB2$catchify(() => {
|
|
1308
1282
|
r();
|
|
1309
1283
|
div.remove();
|
|
1310
|
-
}),
|
|
1284
|
+
}), 500);
|
|
1311
1285
|
});
|
|
1312
1286
|
const {
|
|
1313
1287
|
style: style
|
|
@@ -1340,7 +1314,7 @@ async function $62a8f670f8464532$var$checkIfIsAffectedByChromeBug326498383() {
|
|
|
1340
1314
|
}
|
|
1341
1315
|
return isAffected;
|
|
1342
1316
|
}
|
|
1343
|
-
var $7555dcad3b8a4632$var$_tmpl$ = ["<div", ' class="scroll-padding">', "</div>"];
|
|
1317
|
+
var $7555dcad3b8a4632$var$_tmpl$ = ["<div", ' class="scroll-padding"><div class="', '" style="', '">', "</div></div>"];
|
|
1344
1318
|
function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
|
|
1345
1319
|
displays_: displays_,
|
|
1346
1320
|
FavoriteButton_: FavoriteButton_,
|
|
@@ -1349,7 +1323,8 @@ function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
|
|
|
1349
1323
|
animationDuration_: animationDuration_,
|
|
1350
1324
|
supportsHover_: supportsHover_,
|
|
1351
1325
|
priceFormatting_: priceFormatting_,
|
|
1352
|
-
pseudoRouter_: pseudoRouter_
|
|
1326
|
+
pseudoRouter_: pseudoRouter_,
|
|
1327
|
+
containerHeight_: containerHeight_
|
|
1353
1328
|
}) {
|
|
1354
1329
|
let isAffectedByChromeBug = false;
|
|
1355
1330
|
// If the user requests the drawer to be expanded or not
|
|
@@ -1367,13 +1342,9 @@ function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
|
|
|
1367
1342
|
return containerWidth_() || !displays_();
|
|
1368
1343
|
},
|
|
1369
1344
|
get children() {
|
|
1370
|
-
return $i7OB2$ssr($7555dcad3b8a4632$var$_tmpl$, $i7OB2$ssrHydrationKey(), $
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
}
|
|
1374
|
-
}, () => displays_() && {
|
|
1375
|
-
style: `--look-card-width:${containerWidth_()}px;--look-item-height:${lookItemHeight() || 200}px`
|
|
1376
|
-
}), () => $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Index), {
|
|
1345
|
+
return $i7OB2$ssr($7555dcad3b8a4632$var$_tmpl$, $i7OB2$ssrHydrationKey(), `look-overlay ${userWantsExpanded() ? "expanded" : ""} ${!getSecondPartAnimationRunning() && userWantsExpanded() ? "resting-fully-expanded" : ""}`, $i7OB2$ssrStyle(displays_() &&
|
|
1346
|
+
// The styling is written like this to eke out animation smoothness on low CPU devices, git blame for previous, more readable versions.
|
|
1347
|
+
`--look-card-width:${containerWidth_()}px;--look-card-height:${containerHeight_()}px;--look-item-height:${lookItemHeight() || 200}px`), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Index), {
|
|
1377
1348
|
get each() {
|
|
1378
1349
|
return displays_() || Array.from({
|
|
1379
1350
|
length: 4
|
|
@@ -1396,7 +1367,7 @@ function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
|
|
|
1396
1367
|
})
|
|
1397
1368
|
});
|
|
1398
1369
|
}
|
|
1399
|
-
}))
|
|
1370
|
+
})));
|
|
1400
1371
|
}
|
|
1401
1372
|
});
|
|
1402
1373
|
}
|
|
@@ -1422,7 +1393,7 @@ function $7555dcad3b8a4632$var$scrollingFunctionForChrome(element, targetScrollY
|
|
|
1422
1393
|
// Bootstrap our animation - it will get called right before next frame shall be rendered.
|
|
1423
1394
|
requestAnimationFrame(step);
|
|
1424
1395
|
}
|
|
1425
|
-
var $28ee4f7db3cc44b8$var$_tmpl$ = ["<div", ' class="', '"
|
|
1396
|
+
var $28ee4f7db3cc44b8$var$_tmpl$ = ["<div", ' class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"];
|
|
1426
1397
|
function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
|
|
1427
1398
|
display_: display_,
|
|
1428
1399
|
expandedLooksSignal_: [expandedLooks_, setExpandedLooks],
|
|
@@ -1432,12 +1403,13 @@ function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
|
|
|
1432
1403
|
priceFormatting_: priceFormatting_,
|
|
1433
1404
|
pseudoRouter_: pseudoRouter_
|
|
1434
1405
|
}) {
|
|
1406
|
+
let container;
|
|
1435
1407
|
const useWantsExpandedSignal_ = $i7OB2$createSignal(false);
|
|
1436
1408
|
const [userWantsExpanded, setUserWantsExpanded] = useWantsExpandedSignal_;
|
|
1437
1409
|
const supportsHover_ = $dc9262ef6f786812$export$d9f36cf74e24d595("(hover: hover) and (pointer: fine)");
|
|
1438
1410
|
const us = Symbol("look");
|
|
1439
|
-
const
|
|
1440
|
-
const
|
|
1411
|
+
const [containerWidth_, setContainerWidth] = $i7OB2$createSignal();
|
|
1412
|
+
const [containerHeight_, setContainerHeight] = $i7OB2$createSignal();
|
|
1441
1413
|
const clickHandler = $i7OB2$catchify(({
|
|
1442
1414
|
target: target
|
|
1443
1415
|
}) => {
|
|
@@ -1458,7 +1430,7 @@ function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
|
|
|
1458
1430
|
}));
|
|
1459
1431
|
// Close us if another look expands
|
|
1460
1432
|
$i7OB2$createEffect(() => !expandedLooks_().has(us) && setUserWantsExpanded(false));
|
|
1461
|
-
$i7OB2$
|
|
1433
|
+
return $i7OB2$ssr($28ee4f7db3cc44b8$var$_tmpl$, $i7OB2$ssrHydrationKey(), `look-card ${!display_ ? "placeholder" : ""}`, $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
1462
1434
|
get when() {
|
|
1463
1435
|
return display_();
|
|
1464
1436
|
},
|
|
@@ -1476,7 +1448,7 @@ function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
|
|
|
1476
1448
|
autoAdjustAspectRatio: true
|
|
1477
1449
|
});
|
|
1478
1450
|
}
|
|
1479
|
-
}), $i7OB2$createComponent((0, $7555dcad3b8a4632$export$ebf0b1d4f90c09ae), {
|
|
1451
|
+
})), $i7OB2$escape($i7OB2$createComponent((0, $7555dcad3b8a4632$export$ebf0b1d4f90c09ae), {
|
|
1480
1452
|
displays_: () => display_()?.displays,
|
|
1481
1453
|
userWantsExpandedSignal_: useWantsExpandedSignal_,
|
|
1482
1454
|
containerWidth_: containerWidth_,
|
|
@@ -1484,9 +1456,9 @@ function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
|
|
|
1484
1456
|
supportsHover_: supportsHover_,
|
|
1485
1457
|
FavoriteButton_: FavoriteButton_,
|
|
1486
1458
|
priceFormatting_: priceFormatting_,
|
|
1487
|
-
pseudoRouter_: pseudoRouter_
|
|
1488
|
-
|
|
1489
|
-
|
|
1459
|
+
pseudoRouter_: pseudoRouter_,
|
|
1460
|
+
containerHeight_: containerHeight_
|
|
1461
|
+
})));
|
|
1490
1462
|
}
|
|
1491
1463
|
|
|
1492
1464
|
/**
|
|
@@ -2835,6 +2807,34 @@ let $f86ba724282f6690$export$44dad306455dddf;
|
|
|
2835
2807
|
DEPICT_ID["SEARCH_PAGE"] = "depict-search-page";
|
|
2836
2808
|
DEPICT_ID["PLP_CATEGORY"] = "depict-plp-category";
|
|
2837
2809
|
})($f86ba724282f6690$export$44dad306455dddf || ($f86ba724282f6690$export$44dad306455dddf = {}));
|
|
2810
|
+
|
|
2811
|
+
/** @jsxImportSource solid-js */
|
|
2812
|
+
|
|
2813
|
+
function $2449872a62a75a20$export$ebdc3711f7e02ccd(what_to_watch) {
|
|
2814
|
+
const [width, setWidth] = $i7OB2$createSignal();
|
|
2815
|
+
const resizeObserver = new ResizeObserver($i7OB2$catchify(records => {
|
|
2816
|
+
for (let j = 0; j < records.length; j++) {
|
|
2817
|
+
const width = records[j].borderBoxSize?.[0]?.inlineSize ?? what_to_watch.getBoundingClientRect().width;
|
|
2818
|
+
setWidth(width);
|
|
2819
|
+
}
|
|
2820
|
+
}));
|
|
2821
|
+
// If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
|
|
2822
|
+
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
2823
|
+
const disconnect = (0, $i7OB2$observer).onexists(what_to_watch, ({
|
|
2824
|
+
element: element
|
|
2825
|
+
}) => requestAnimationFrame($i7OB2$catchify(() => {
|
|
2826
|
+
const current_size = what_to_watch.getBoundingClientRect().width;
|
|
2827
|
+
if (current_size)
|
|
2828
|
+
// If element has size, set signal to that. ResizeObserver only triggers when the content is visible in some cases, but it might already have a size. This reduces size filter expanding animation jank in chrome.
|
|
2829
|
+
setWidth(current_size);
|
|
2830
|
+
resizeObserver.observe(element);
|
|
2831
|
+
})));
|
|
2832
|
+
$i7OB2$onCleanup(() => {
|
|
2833
|
+
resizeObserver.disconnect();
|
|
2834
|
+
disconnect();
|
|
2835
|
+
});
|
|
2836
|
+
return width;
|
|
2837
|
+
}
|
|
2838
2838
|
var $081752ca508a876f$var$_tmpl$ = '<path fill-rule="evenodd" d="M9.563 3.438c-3.107 0-5.625 2.518-5.625 5.625s2.518 5.625 5.625 5.625 5.625-2.518 5.625-5.625-2.518-5.625-5.625-5.625zm-7.5 5.625a7.5 7.5 0 1 1 15 0c0 1.733-.588 3.329-1.575 4.599l3.176 3.176a.94.94 0 0 1 0 1.326.94.94 0 0 1-1.326 0l-3.176-3.176a7.47 7.47 0 0 1-4.599 1.575 7.5 7.5 0 0 1-7.5-7.5z" fill="#0f0f0f"></path>';
|
|
2839
2839
|
function $081752ca508a876f$export$f7658c347b037c3f(props = {}) {
|
|
2840
2840
|
return $i7OB2$ssrElement("svg", $i7OB2$mergeProps({
|