@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/ES10/index.cjs
CHANGED
|
@@ -35,6 +35,8 @@ $parcel$export(module.exports, "decode_sorting", () => $a68b73fd7ba0853f$export$
|
|
|
35
35
|
$parcel$export(module.exports, "shopifyContainedImageContextSymbol", () => $28535bb7671c63d1$export$d7b7ab832c20e2f4);
|
|
36
36
|
$parcel$export(module.exports, "ListingProvider", () => $d067f3a30f047b41$export$e68cff63f76bd15b);
|
|
37
37
|
$parcel$export(module.exports, "useListing", () => $d067f3a30f047b41$export$8d0c4fdbb05a2f2e);
|
|
38
|
+
$parcel$export(module.exports, "ProductCardIndexProvider", () => $b54645378dfc7280$export$11354f017ddc9790);
|
|
39
|
+
$parcel$export(module.exports, "useProductCardIndex", () => $b54645378dfc7280$export$e3faf4d95300054f);
|
|
38
40
|
$parcel$export(module.exports, "ShopifyContainedImage", () => $28535bb7671c63d1$export$e4b984597b71e989);
|
|
39
41
|
$parcel$export(module.exports, "SlidableItems", () => $ad8ec7729fffeb9c$export$6649caad96ef8870);
|
|
40
42
|
$parcel$export(module.exports, "make_accurate_width_accessor", () => $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd);
|
|
@@ -92,7 +94,7 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447a
|
|
|
92
94
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
93
95
|
$parcel$export(module.exports, "SearchField", () => $98aef9965764903d$export$316f6f283ae64765);
|
|
94
96
|
/*! Depict.ai search and product listing SDK */
|
|
95
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.
|
|
97
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.8";
|
|
96
98
|
function $a28000bc10de28ad$export$e417c49320921907(dependency, fetcher) {
|
|
97
99
|
const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $52FdA$solidjs.createSignal();
|
|
98
100
|
const deparallelizedFetcher = $52FdA$depictaiutilishared.deparallelize_no_drop(async dependencyValue => {
|
|
@@ -451,6 +453,20 @@ function $e82d0d417fa613e8$var$unwrapping_helper(elements) {
|
|
|
451
453
|
} else if (typeof elements == "function") result.push(...$e82d0d417fa613e8$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
|
|
452
454
|
return result;
|
|
453
455
|
}
|
|
456
|
+
const $b54645378dfc7280$var$ProductCardIndexContext = /*@__PURE__*/$52FdA$solidjs.createContext();
|
|
457
|
+
function $b54645378dfc7280$export$11354f017ddc9790(props) {
|
|
458
|
+
return $52FdA$solidjsweb.createComponent($b54645378dfc7280$var$ProductCardIndexContext.Provider, {
|
|
459
|
+
get value() {
|
|
460
|
+
return props.index_;
|
|
461
|
+
},
|
|
462
|
+
get children() {
|
|
463
|
+
return props.children;
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
function $b54645378dfc7280$export$e3faf4d95300054f() {
|
|
468
|
+
return $52FdA$solidjs.useContext($b54645378dfc7280$var$ProductCardIndexContext);
|
|
469
|
+
}
|
|
454
470
|
let $76012c4468a53d1f$var$printedCloneError = false;
|
|
455
471
|
function $76012c4468a53d1f$export$7f8bd308237ab5a5(get_displays_) {
|
|
456
472
|
const displays_by_key_ = $52FdA$solidjs.createMemo(() => {
|
|
@@ -508,9 +524,22 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
508
524
|
$52FdA$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);
|
|
509
525
|
}
|
|
510
526
|
}
|
|
511
|
-
|
|
512
|
-
|
|
527
|
+
let renderingResult;
|
|
528
|
+
// Wrap the product card in a ProductCardIndexProvider so that the index is available to the product card
|
|
529
|
+
// This is wo we can do intelligent image loading in ShopifyContainedImage without shopify devs having to pass in the index
|
|
530
|
+
// 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
|
|
531
|
+
$b54645378dfc7280$export$11354f017ddc9790({
|
|
532
|
+
index_: index,
|
|
533
|
+
get children() {
|
|
534
|
+
// 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
|
|
535
|
+
renderingResult = product_card_template_(display, {
|
|
536
|
+
set_on_index_change: fn => $52FdA$solidjs.runWithOwner(owner, () => $52FdA$solidjs.createEffect(() => fn(index())))
|
|
537
|
+
});
|
|
538
|
+
return undefined; // just to satisfy the typing
|
|
539
|
+
}
|
|
513
540
|
});
|
|
541
|
+
// 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)
|
|
542
|
+
return renderingResult;
|
|
514
543
|
});
|
|
515
544
|
const node_accessor = $e82d0d417fa613e8$export$2f0cbfbb4354bb52(product_card_resource);
|
|
516
545
|
$52FdA$solidjs.createEffect(() => {
|
|
@@ -535,7 +564,8 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
535
564
|
});
|
|
536
565
|
return [
|
|
537
566
|
// Show content block before product card, so it's *at* that index
|
|
538
|
-
possible_content_block,
|
|
567
|
+
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,
|
|
568
|
+
]; // Regarding the as unknown shenanigans: https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
539
569
|
}
|
|
540
570
|
});
|
|
541
571
|
}
|
|
@@ -2507,6 +2537,34 @@ function $ce467edb5343cfcd$export$94026ee33dbabc26(props) {
|
|
|
2507
2537
|
return _el$;
|
|
2508
2538
|
})();
|
|
2509
2539
|
}
|
|
2540
|
+
let $e4e98e5080f4386e$var$browserIsBugged = false;
|
|
2541
|
+
function $e4e98e5080f4386e$export$2972b890694ced75(callback, _ref) {
|
|
2542
|
+
let {
|
|
2543
|
+
timeout: timeout
|
|
2544
|
+
} = _ref;
|
|
2545
|
+
if ($e4e98e5080f4386e$var$browserIsBugged) timeout /= 4;
|
|
2546
|
+
const cancel = () => {
|
|
2547
|
+
cancelIdleCallback(idleHandle);
|
|
2548
|
+
clearTimeout(racingTimeout);
|
|
2549
|
+
};
|
|
2550
|
+
const idleHandle = requestIdleCallback(deadline => {
|
|
2551
|
+
cancel();
|
|
2552
|
+
return callback(deadline);
|
|
2553
|
+
}, {
|
|
2554
|
+
timeout: timeout
|
|
2555
|
+
});
|
|
2556
|
+
const racingTimeout = setTimeout(() => {
|
|
2557
|
+
$e4e98e5080f4386e$var$browserIsBugged = true;
|
|
2558
|
+
cancel();
|
|
2559
|
+
callback({
|
|
2560
|
+
didTimeout: false,
|
|
2561
|
+
timeRemaining() {
|
|
2562
|
+
return 500;
|
|
2563
|
+
}
|
|
2564
|
+
});
|
|
2565
|
+
}, timeout + 1000);
|
|
2566
|
+
return cancel;
|
|
2567
|
+
}
|
|
2510
2568
|
function $858fdcf73148519f$export$e6fffe67d4cdd848(whatToWatch) {
|
|
2511
2569
|
const [size, setSize] = $52FdA$solidjs.createSignal(0);
|
|
2512
2570
|
const resizeObserver = new ResizeObserver($52FdA$depictaiutilishared.catchify(records => {
|
|
@@ -2534,6 +2592,7 @@ function $858fdcf73148519f$export$e6fffe67d4cdd848(whatToWatch) {
|
|
|
2534
2592
|
}
|
|
2535
2593
|
const $858fdcf73148519f$var$onIdleFunctionsSymbol = /*@__PURE__*/Symbol("onIdleFunctions");
|
|
2536
2594
|
const $858fdcf73148519f$export$f8945274f08a3105 = /*@__PURE__*/Symbol("listingContextAspectRatios");
|
|
2595
|
+
const $858fdcf73148519f$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingContextAspectRatios");
|
|
2537
2596
|
function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
2538
2597
|
// Enable reactive props
|
|
2539
2598
|
const otherOptions = $52FdA$solidjs.createMemo(() => {
|
|
@@ -2548,9 +2607,8 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
2548
2607
|
return cloned_props;
|
|
2549
2608
|
});
|
|
2550
2609
|
const src_options = $52FdA$solidjs.createMemo(() => {
|
|
2551
|
-
const
|
|
2552
|
-
const
|
|
2553
|
-
const srcset = $858fdcf73148519f$var$make_srcset(src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096]);
|
|
2610
|
+
const fallback_src = $858fdcf73148519f$var$generateImageUrl(props.src, 400);
|
|
2611
|
+
const srcset = $858fdcf73148519f$var$make_srcset(props.src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096]);
|
|
2554
2612
|
// The order here *might* matter - I've seen mobile safari always start with loading the 400px version when it was reversed
|
|
2555
2613
|
return {
|
|
2556
2614
|
srcset: srcset,
|
|
@@ -2561,17 +2619,27 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
2561
2619
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
2562
2620
|
const [hasSetSize, setHasSetSize] = $52FdA$solidjs.createSignal(false);
|
|
2563
2621
|
const [hasDecoded, setHasDecoded] = $52FdA$solidjs.createSignal(false);
|
|
2622
|
+
const productCardIndexAccessor = $b54645378dfc7280$export$e3faf4d95300054f();
|
|
2564
2623
|
const sizePX = $52FdA$solidjs.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
|
|
2565
2624
|
const listingContext = $d067f3a30f047b41$export$8d0c4fdbb05a2f2e();
|
|
2625
|
+
const isPrioritisedImage = $52FdA$solidjs.createMemo(() => (productCardIndexAccessor === null || productCardIndexAccessor === void 0 ? void 0 : productCardIndexAccessor()) < 8);
|
|
2626
|
+
const loadLazily = $52FdA$solidjs.createMemo(() => {
|
|
2627
|
+
const {
|
|
2628
|
+
loading: loading
|
|
2629
|
+
} = props;
|
|
2630
|
+
if (loading === "force-lazy") return true;
|
|
2631
|
+
return loading === "lazy" && !isPrioritisedImage();
|
|
2632
|
+
});
|
|
2566
2633
|
// 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
|
|
2567
2634
|
// Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
|
|
2568
2635
|
const executeWhenIdleBatched = fn => {
|
|
2569
2636
|
if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
|
|
2637
|
+
if ($52FdA$solidjs.untrack(isPrioritisedImage)) return fn(); // If we're one of the first 8 images, execute the callbacks immediately
|
|
2570
2638
|
const existingStack = listingContext === null || listingContext === void 0 ? void 0 : listingContext[$858fdcf73148519f$var$onIdleFunctionsSymbol];
|
|
2571
2639
|
if (existingStack) return existingStack.add(fn);
|
|
2572
2640
|
const newStack = new Set([fn]);
|
|
2573
2641
|
if (listingContext) listingContext[$858fdcf73148519f$var$onIdleFunctionsSymbol] = newStack;
|
|
2574
|
-
const processStackWhenIdle = () =>
|
|
2642
|
+
const processStackWhenIdle = () => $e4e98e5080f4386e$export$2972b890694ced75($52FdA$depictaiutilishared.catchify(deadline => {
|
|
2575
2643
|
const start = performance.now();
|
|
2576
2644
|
const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
|
|
2577
2645
|
for (const fn of newStack) {
|
|
@@ -2586,7 +2654,7 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
2586
2654
|
}
|
|
2587
2655
|
// Stack is empty
|
|
2588
2656
|
if (listingContext) delete listingContext[$858fdcf73148519f$var$onIdleFunctionsSymbol];
|
|
2589
|
-
}, {
|
|
2657
|
+
}), {
|
|
2590
2658
|
timeout: 15000
|
|
2591
2659
|
} // 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
|
|
2592
2660
|
);
|
|
@@ -2600,7 +2668,8 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
2600
2668
|
img.classList.add("s-responsive-image");
|
|
2601
2669
|
if (listingContext) {
|
|
2602
2670
|
let prevValue;
|
|
2603
|
-
const aspectRatios = listingContext[$858fdcf73148519f$export$f8945274f08a3105] || (listingContext[$858fdcf73148519f$export$f8945274f08a3105] = new (
|
|
2671
|
+
const aspectRatios = listingContext[$858fdcf73148519f$export$f8945274f08a3105] || (listingContext[$858fdcf73148519f$export$f8945274f08a3105] = new Set());
|
|
2672
|
+
const [, setMostPrevalentAspectRatio] = listingContext[$858fdcf73148519f$export$6066eb417ed2e9f7] || (listingContext[$858fdcf73148519f$export$6066eb417ed2e9f7] = $52FdA$solidjs.createSignal());
|
|
2604
2673
|
img.addEventListener("load", $52FdA$depictaiutilishared.catchify(() => {
|
|
2605
2674
|
// Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2
|
|
2606
2675
|
const aspectRatio_ = img.naturalWidth / img.naturalHeight;
|
|
@@ -2610,13 +2679,22 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
2610
2679
|
} : undefined;
|
|
2611
2680
|
if (newValue) aspectRatios.add(newValue);
|
|
2612
2681
|
prevValue = newValue;
|
|
2682
|
+
// Do all calculations resulting of an update directly, for performance
|
|
2683
|
+
const asArray = [...aspectRatios].map(_ref2 => {
|
|
2684
|
+
let {
|
|
2685
|
+
aspectRatio_: aspectRatio_
|
|
2686
|
+
} = _ref2;
|
|
2687
|
+
return aspectRatio_;
|
|
2688
|
+
});
|
|
2689
|
+
const mostPrevalentAspectRatio = $52FdA$depictaiutilishared.findMostFrequentItem(asArray);
|
|
2690
|
+
setMostPrevalentAspectRatio(mostPrevalentAspectRatio);
|
|
2613
2691
|
}));
|
|
2614
2692
|
$52FdA$solidjs.onCleanup(() => prevValue && aspectRatios.delete(prevValue));
|
|
2615
2693
|
}
|
|
2616
2694
|
$52FdA$solidjs.onCleanup(() => gotCleanedUp = true);
|
|
2617
2695
|
$52FdA$solidjsweb.spread(img, $52FdA$solidjs.mergeProps(otherOptions), false, true);
|
|
2618
2696
|
$52FdA$solidjs.createEffect(() => {
|
|
2619
|
-
if (!props.size()) return; // wait until we have a size
|
|
2697
|
+
if (!props.size()) return; // wait until we have a size, run every time the size changes
|
|
2620
2698
|
if (timeoutSet) return;
|
|
2621
2699
|
const handler = $52FdA$depictaiutilishared.catchify(() => {
|
|
2622
2700
|
if (gotCleanedUp) return;
|
|
@@ -2641,7 +2719,7 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
2641
2719
|
// We can do this because there has to be a container around us giving us a size
|
|
2642
2720
|
// No need to listen if we're already in the DOM
|
|
2643
2721
|
if (hasDecodedFastPath) return;
|
|
2644
|
-
if (
|
|
2722
|
+
if (loadLazily()) {
|
|
2645
2723
|
// For lazy loading there's no decoding to wait for as it only occurs when the image is visible
|
|
2646
2724
|
// Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
|
|
2647
2725
|
setHasDecoded(true);
|
|
@@ -2668,9 +2746,10 @@ function $858fdcf73148519f$var$make_srcset(url, resolutions) {
|
|
|
2668
2746
|
return resolutions.map(width => "".concat($858fdcf73148519f$var$generateImageUrl(url, width), " ").concat(width, "w")).join(", ");
|
|
2669
2747
|
}
|
|
2670
2748
|
function $858fdcf73148519f$var$generateImageUrl(url, width) {
|
|
2671
|
-
//
|
|
2672
|
-
url
|
|
2673
|
-
|
|
2749
|
+
// 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)
|
|
2750
|
+
// 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)
|
|
2751
|
+
// That way we can just to string concatenation which is insanely fast
|
|
2752
|
+
return url + "&width=" + encodeURIComponent(width);
|
|
2674
2753
|
}
|
|
2675
2754
|
const $28535bb7671c63d1$var$backupSizeSignal = /*@__PURE__*/$52FdA$solidjs.createSignal();
|
|
2676
2755
|
const $28535bb7671c63d1$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
|
|
@@ -2680,41 +2759,23 @@ function $28535bb7671c63d1$export$e4b984597b71e989(props) {
|
|
|
2680
2759
|
// create a signal that's the same for all items in this listing
|
|
2681
2760
|
context[$28535bb7671c63d1$export$d7b7ab832c20e2f4] = $52FdA$solidjs.createSignal();
|
|
2682
2761
|
const [currentImageSize, setCurrentImageSize] = (context === null || context === void 0 ? void 0 : context[$28535bb7671c63d1$export$d7b7ab832c20e2f4]) || $28535bb7671c63d1$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
|
|
2683
|
-
const
|
|
2684
|
-
const
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
const aspectRatioToUse = $52FdA$solidjs.createMemo(() => {
|
|
2688
|
-
const aspectRatiosSet = aspectRatios(); // This signal "changes" to the same set every time the set changes, so we can use it as a dependency here
|
|
2689
|
-
useMostPrevalentAspectRatio: {
|
|
2690
|
-
if (!aspectRatiosSet || !props.autoAdjustAspectRatio) break useMostPrevalentAspectRatio;
|
|
2691
|
-
// Get the aspect ratio that most of the loaded images inside the ListingProvider we are, load
|
|
2692
|
-
const asArray = [...aspectRatiosSet].map(_ref => {
|
|
2693
|
-
let {
|
|
2694
|
-
aspectRatio_: aspectRatio_
|
|
2695
|
-
} = _ref;
|
|
2696
|
-
return aspectRatio_;
|
|
2697
|
-
});
|
|
2698
|
-
const mostPrevalentAspectRatio = $52FdA$depictaiutilishared.findMostFrequentItem(asArray);
|
|
2699
|
-
if (mostPrevalentAspectRatio) return "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(mostPrevalentAspectRatio, ")");
|
|
2700
|
-
}
|
|
2701
|
-
return props.aspectRatio;
|
|
2702
|
-
});
|
|
2703
|
-
const container = $52FdA$solidjsweb.createComponent((0, $ce467edb5343cfcd$export$94026ee33dbabc26), {
|
|
2704
|
-
get aspectRatio() {
|
|
2705
|
-
return aspectRatioToUse();
|
|
2706
|
-
},
|
|
2707
|
-
get ["class"]() {
|
|
2762
|
+
const [mostPrevalentAspectRatio] = context ? context[(0, $858fdcf73148519f$export$6066eb417ed2e9f7)] || (context[(0, $858fdcf73148519f$export$6066eb417ed2e9f7)] = $52FdA$solidjs.createSignal()) : [];
|
|
2763
|
+
const container = $ce467edb5343cfcd$export$94026ee33dbabc26({
|
|
2764
|
+
// Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
|
|
2765
|
+
get class() {
|
|
2708
2766
|
return props.class;
|
|
2767
|
+
},
|
|
2768
|
+
get aspectRatio() {
|
|
2769
|
+
if (props.autoAdjustAspectRatio) {
|
|
2770
|
+
const targetRatio = mostPrevalentAspectRatio === null || mostPrevalentAspectRatio === void 0 ? void 0 : mostPrevalentAspectRatio();
|
|
2771
|
+
if (targetRatio != undefined) return "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(targetRatio, ")");
|
|
2772
|
+
}
|
|
2773
|
+
return props.aspectRatio;
|
|
2709
2774
|
}
|
|
2710
2775
|
});
|
|
2711
2776
|
const owner = $52FdA$solidjs.getOwner();
|
|
2712
2777
|
let createdSizeAccessor = false;
|
|
2713
2778
|
let wasCleanedUp = false;
|
|
2714
|
-
for (const event of ["add", "delete"]) {
|
|
2715
|
-
aspectRatiosSet === null || aspectRatiosSet === void 0 || aspectRatiosSet.addEventListener(event, () => setAspectRatios(aspectRatiosSet));
|
|
2716
|
-
$52FdA$solidjs.onCleanup(() => aspectRatiosSet === null || aspectRatiosSet === void 0 ? void 0 : aspectRatiosSet.removeEventListener(event, () => setAspectRatios(aspectRatiosSet)));
|
|
2717
|
-
}
|
|
2718
2779
|
$52FdA$solidjs.createEffect(() => {
|
|
2719
2780
|
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
2720
2781
|
// ensure we always have a size accessor
|
|
@@ -6319,7 +6380,7 @@ function $0257c760a99bfacb$export$e0d834a0ad870cda(_ref) {
|
|
|
6319
6380
|
$52FdA$solidjs.createComputed(() => {
|
|
6320
6381
|
var _selected_filter;
|
|
6321
6382
|
const defined_filter_data = (_selected_filter = selected_filter()) === null || _selected_filter === void 0 ? void 0 : _selected_filter.data;
|
|
6322
|
-
const default_data =
|
|
6383
|
+
const default_data = defaultRange();
|
|
6323
6384
|
if (Array.isArray(defined_filter_data)) current_range[1](defined_filter_data);else current_range[1](default_data);
|
|
6324
6385
|
});
|
|
6325
6386
|
$52FdA$solidjs.createComputed(() => {
|
package/ES10/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
|
|
|
10
10
|
import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
|
|
13
|
-
export const version = "4.0.
|
|
13
|
+
export const version = "4.0.8";
|
|
14
14
|
export type ModalAlignmentSignals = {
|
|
15
15
|
body_: Signal<JSX.CSSProperties>;
|
|
16
16
|
field_: Signal<JSX.CSSProperties>;
|
|
@@ -388,6 +388,17 @@ export function ImageContainer(props: {
|
|
|
388
388
|
class?: string;
|
|
389
389
|
children?: JSX.Element;
|
|
390
390
|
}): HTMLDivElement;
|
|
391
|
+
/**
|
|
392
|
+
* Provider to wrap every product card that gets rendered in (in PLPResults rendering internals), enables using useProductCardIndex anywhere inside the product card to get the index of the product card.
|
|
393
|
+
*/
|
|
394
|
+
export function ProductCardIndexProvider(props: {
|
|
395
|
+
children: JSX.Element;
|
|
396
|
+
index_: Accessor<number>;
|
|
397
|
+
}): JSX.Element;
|
|
398
|
+
/**
|
|
399
|
+
* Use this to get an accessor containing the index of your product card.
|
|
400
|
+
*/
|
|
401
|
+
export function useProductCardIndex(): Accessor<number> | undefined;
|
|
391
402
|
/**
|
|
392
403
|
* Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
|
|
393
404
|
*/
|
|
@@ -395,6 +406,7 @@ export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
|
|
|
395
406
|
/**
|
|
396
407
|
* Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
|
|
397
408
|
* Will also delay loading and decoding of image until the browser is idle (with 5s timeout) to improve filtering/loading more performance.
|
|
409
|
+
* If ran within Depict product card rendering, within one of the first 8 product cards, those images will be loaded immediately and loading="lazy" will be ignored for them (unless you set it to "force-lazy").
|
|
398
410
|
* This is used for our responsive images:
|
|
399
411
|
* 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.
|
|
400
412
|
* 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
|
|
@@ -404,8 +416,9 @@ export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
|
|
|
404
416
|
export function ShopifyResponsiveImg(props: {
|
|
405
417
|
resolutions?: number[];
|
|
406
418
|
size: Accessor<number>;
|
|
407
|
-
} & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes"> & {
|
|
419
|
+
} & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes" | "loading"> & {
|
|
408
420
|
src: string;
|
|
421
|
+
loading?: "eager" | "lazy" | "force-lazy";
|
|
409
422
|
}): JSX.Element;
|
|
410
423
|
type ImagePlaceholderBaseOptions = {
|
|
411
424
|
style?: JSX.CSSProperties;
|