@depict-ai/ui 4.0.1 → 4.0.2
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 +55 -4
- package/ES10/index.d.ts +25 -23
- package/ES10/index.js +59 -8
- package/latest/index.cjs +52 -4
- package/latest/index.d.ts +25 -23
- package/latest/index.js +56 -8
- package/package.json +3 -3
- package/server/ES10/index.cjs +55 -4
- package/server/ES10/index.d.ts +25 -23
- package/server/ES10/index.js +59 -8
- package/server/latest/index.cjs +52 -4
- package/server/latest/index.d.ts +25 -23
- package/server/latest/index.js +56 -8
package/server/latest/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.2";
|
|
14
14
|
export type ModalAlignmentSignals = {
|
|
15
15
|
body_: Signal<JSX.CSSProperties>;
|
|
16
16
|
field_: Signal<JSX.CSSProperties>;
|
|
@@ -407,6 +407,28 @@ export function ShopifyResponsiveImg(props: {
|
|
|
407
407
|
} & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes"> & {
|
|
408
408
|
src: string;
|
|
409
409
|
}): JSX.Element;
|
|
410
|
+
type ImagePlaceholderBaseOptions = {
|
|
411
|
+
style?: JSX.CSSProperties;
|
|
412
|
+
class?: string;
|
|
413
|
+
};
|
|
414
|
+
type ImagePlaceholderBlockOptions = {
|
|
415
|
+
width: string;
|
|
416
|
+
height: string;
|
|
417
|
+
};
|
|
418
|
+
type ImagePlaceholderImageOptions = {
|
|
419
|
+
aspectRatio: number | string;
|
|
420
|
+
};
|
|
421
|
+
/**
|
|
422
|
+
* A placeholder that can be used instead of an image or other block of content while it's loading.
|
|
423
|
+
* The placeholder has `display:block`, meaning it will create a new "row" in the layout for itself. Can be used either for images with a defined aspect ratio (ContainedImage) or blocks.
|
|
424
|
+
* @property aspectRatio if aspectRatio is defined the placeholder will be in "image mode" and fill out the available width and then adjust the height according to the aspectRatio
|
|
425
|
+
* @property width If width and height is set, the defined width and height will be used.
|
|
426
|
+
* @property height If width and height is set, the defined width and height will be used.
|
|
427
|
+
* @property class extra classes to add to the placeholder
|
|
428
|
+
* @property style extra styles to add to the placeholder
|
|
429
|
+
*/
|
|
430
|
+
export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
|
|
431
|
+
export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
410
432
|
export const shopifyContainedImageContextSymbol: unique symbol;
|
|
411
433
|
/**
|
|
412
434
|
* Abstraction built on top of ShopifyResponsiveImg. This is your one-stop-shop If you just need a responsive image.
|
|
@@ -417,11 +439,13 @@ export const shopifyContainedImageContextSymbol: unique symbol;
|
|
|
417
439
|
* @property aspectRatio aspect ratio of the image
|
|
418
440
|
* @property class extra class to add to the container
|
|
419
441
|
* @property alt alt text for the image
|
|
442
|
+
* @property autoAdjustAspectRatio whether to automatically adjust the aspect ratio of the image to the majority of the aspect ratios of loaded images in the current listing provider. Defaults to false. Can be overriden with css variable --image-aspect-ratio
|
|
420
443
|
* @property imgProps props to pass to ShopifyResponsiveImg to add to the <img> element
|
|
421
444
|
*/
|
|
422
445
|
export function ShopifyContainedImage(props: {
|
|
423
446
|
src: string;
|
|
424
447
|
aspectRatio: number | string;
|
|
448
|
+
autoAdjustAspectRatio?: boolean;
|
|
425
449
|
class?: string;
|
|
426
450
|
imgProps?: Omit<Parameters<typeof ShopifyResponsiveImg>[0], "size" | "src">;
|
|
427
451
|
}): HTMLDivElement;
|
|
@@ -489,28 +513,6 @@ interface Styles {
|
|
|
489
513
|
[selector: string]: JSX.CSSProperties;
|
|
490
514
|
}
|
|
491
515
|
export const styles_to_valid_css_string: (styles: Styles) => string;
|
|
492
|
-
type ImagePlaceholderBaseOptions = {
|
|
493
|
-
style?: JSX.CSSProperties;
|
|
494
|
-
class?: string;
|
|
495
|
-
};
|
|
496
|
-
type ImagePlaceholderBlockOptions = {
|
|
497
|
-
width: string;
|
|
498
|
-
height: string;
|
|
499
|
-
};
|
|
500
|
-
type ImagePlaceholderImageOptions = {
|
|
501
|
-
aspectRatio: number | string;
|
|
502
|
-
};
|
|
503
|
-
/**
|
|
504
|
-
* A placeholder that can be used instead of an image or other block of content while it's loading.
|
|
505
|
-
* The placeholder has `display:block`, meaning it will create a new "row" in the layout for itself. Can be used either for images with a defined aspect ratio (ContainedImage) or blocks.
|
|
506
|
-
* @property aspectRatio if aspectRatio is defined the placeholder will be in "image mode" and fill out the available width and then adjust the height according to the aspectRatio
|
|
507
|
-
* @property width If width and height is set, the defined width and height will be used.
|
|
508
|
-
* @property height If width and height is set, the defined width and height will be used.
|
|
509
|
-
* @property class extra classes to add to the placeholder
|
|
510
|
-
* @property style extra styles to add to the placeholder
|
|
511
|
-
*/
|
|
512
|
-
export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
|
|
513
|
-
export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
514
516
|
/**
|
|
515
517
|
* Second generation search modal - the solid component that gets added to <body> when the search modal is opened
|
|
516
518
|
*/
|
package/server/latest/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { add_to_version_info as $i7OB2$add_to_version_info, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, catchify as $i7OB2$catchify, make_random_classname as $i7OB2$make_random_classname, ContainedImage as $i7OB2$ContainedImage, standard_price_format as $i7OB2$standard_price_format, javascript_media_query as $i7OB2$javascript_media_query, dlog as $i7OB2$dlog, camelCasifyObject as $i7OB2$camelCasifyObject, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, observer as $i7OB2$observer, report as $i7OB2$report, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, queueMacroTask as $i7OB2$queueMacroTask, dwarn as $i7OB2$dwarn, slider_fading_factory as $i7OB2$slider_fading_factory, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, use_href_accessor as $i7OB2$use_href_accessor, get_session_id as $i7OB2$get_session_id, add_version_query_params as $i7OB2$add_version_query_params, base_url as $i7OB2$base_url, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, slider_fractional_factory as $i7OB2$slider_fractional_factory, useExpandingContainer as $i7OB2$useExpandingContainer, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, snakeCasifyObject as $i7OB2$snakeCasifyObject, fetch_retry as $i7OB2$fetch_retry, sort_obj as $i7OB2$sort_obj, make_url_with_query_params as $i7OB2$make_url_with_query_params,
|
|
1
|
+
import { add_to_version_info as $i7OB2$add_to_version_info, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, catchify as $i7OB2$catchify, make_random_classname as $i7OB2$make_random_classname, ContainedImage as $i7OB2$ContainedImage, standard_price_format as $i7OB2$standard_price_format, javascript_media_query as $i7OB2$javascript_media_query, dlog as $i7OB2$dlog, camelCasifyObject as $i7OB2$camelCasifyObject, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, observer as $i7OB2$observer, report as $i7OB2$report, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, ListenableSet as $i7OB2$ListenableSet, findMostFrequentItem as $i7OB2$findMostFrequentItem, queueMacroTask as $i7OB2$queueMacroTask, dwarn as $i7OB2$dwarn, slider_fading_factory as $i7OB2$slider_fading_factory, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, use_href_accessor as $i7OB2$use_href_accessor, get_session_id as $i7OB2$get_session_id, add_version_query_params as $i7OB2$add_version_query_params, base_url as $i7OB2$base_url, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, slider_fractional_factory as $i7OB2$slider_fractional_factory, useExpandingContainer as $i7OB2$useExpandingContainer, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, snakeCasifyObject as $i7OB2$snakeCasifyObject, fetch_retry as $i7OB2$fetch_retry, sort_obj as $i7OB2$sort_obj, make_url_with_query_params as $i7OB2$make_url_with_query_params, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
|
|
2
2
|
import { createSignal as $i7OB2$createSignal, createResource as $i7OB2$createResource, createEffect as $i7OB2$createEffect, untrack as $i7OB2$untrack, createMemo as $i7OB2$createMemo, onCleanup as $i7OB2$onCleanup, Show as $i7OB2$Show, createComputed as $i7OB2$createComputed, For as $i7OB2$For, getOwner as $i7OB2$getOwner, runWithOwner as $i7OB2$runWithOwner, on as $i7OB2$on, Index as $i7OB2$Index, batch as $i7OB2$batch, ErrorBoundary as $i7OB2$ErrorBoundary, createContext as $i7OB2$createContext, useContext as $i7OB2$useContext, mergeProps as $i7OB2$mergeProps1, createUniqueId as $i7OB2$createUniqueId, createRenderEffect as $i7OB2$createRenderEffect, createSelector as $i7OB2$createSelector, children as $i7OB2$children, splitProps as $i7OB2$splitProps, createRoot as $i7OB2$createRoot, Suspense as $i7OB2$Suspense, createReaction as $i7OB2$createReaction, mapArray as $i7OB2$mapArray } from "solid-js";
|
|
3
3
|
import { ssr as $i7OB2$ssr, ssrHydrationKey as $i7OB2$ssrHydrationKey, escape as $i7OB2$escape, createComponent as $i7OB2$createComponent, ssrAttribute as $i7OB2$ssrAttribute, ssrClassList as $i7OB2$ssrClassList, ssrStyle as $i7OB2$ssrStyle, ssrElement as $i7OB2$ssrElement, mergeProps as $i7OB2$mergeProps, insert as $i7OB2$insert, spread as $i7OB2$spread, isServer as $i7OB2$isServer, Dynamic as $i7OB2$Dynamic } from "solid-js/web";
|
|
4
|
-
import { ListenableSet as $i7OB2$
|
|
4
|
+
import { ListenableSet as $i7OB2$ListenableSet1, catchify as $i7OB2$catchify1, use_href_accessor as $i7OB2$use_href_accessor1, report as $i7OB2$report1 } from "@depict-ai/utilishared/latest";
|
|
5
5
|
import { createStore as $i7OB2$createStore, reconcile as $i7OB2$reconcile } from "solid-js/store";
|
|
6
6
|
|
|
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.0.
|
|
10
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "4.0.2";
|
|
11
11
|
function $136f1d4d6c7ba6ac$export$e417c49320921907(dependency, fetcher) {
|
|
12
12
|
const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $i7OB2$createSignal();
|
|
13
13
|
const deparallelizedFetcher = $i7OB2$deparallelize_no_drop(async dependencyValue => {
|
|
@@ -1785,6 +1785,7 @@ function $e8ffe11ed01df0fe$export$e6fffe67d4cdd848(whatToWatch) {
|
|
|
1785
1785
|
return size;
|
|
1786
1786
|
}
|
|
1787
1787
|
const $e8ffe11ed01df0fe$var$onIdleFunctionsSymbol = /*@__PURE__*/Symbol("onIdleFunctions");
|
|
1788
|
+
const $e8ffe11ed01df0fe$export$f8945274f08a3105 = /*@__PURE__*/Symbol("listingContextAspectRatios");
|
|
1788
1789
|
function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
|
|
1789
1790
|
// Enable reactive props
|
|
1790
1791
|
const otherOptions = $i7OB2$createMemo(() => {
|
|
@@ -1849,6 +1850,21 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
|
|
|
1849
1850
|
let timeoutSet = false;
|
|
1850
1851
|
let gotCleanedUp = false;
|
|
1851
1852
|
img.classList.add("s-responsive-image");
|
|
1853
|
+
if (listingContext) {
|
|
1854
|
+
let prevValue;
|
|
1855
|
+
const aspectRatios = listingContext[$e8ffe11ed01df0fe$export$f8945274f08a3105] ||= new (0, $i7OB2$ListenableSet)();
|
|
1856
|
+
img.addEventListener("load", $i7OB2$catchify(() => {
|
|
1857
|
+
// Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2
|
|
1858
|
+
const aspectRatio_ = img.naturalWidth / img.naturalHeight;
|
|
1859
|
+
if (prevValue) aspectRatios.delete(prevValue);
|
|
1860
|
+
const newValue = !isNaN(aspectRatio_) ? {
|
|
1861
|
+
aspectRatio_: aspectRatio_
|
|
1862
|
+
} : undefined;
|
|
1863
|
+
if (newValue) aspectRatios.add(newValue);
|
|
1864
|
+
prevValue = newValue;
|
|
1865
|
+
}));
|
|
1866
|
+
$i7OB2$onCleanup(() => prevValue && aspectRatios.delete(prevValue));
|
|
1867
|
+
}
|
|
1852
1868
|
$i7OB2$onCleanup(() => gotCleanedUp = true);
|
|
1853
1869
|
$i7OB2$spread(img, $i7OB2$mergeProps1(otherOptions), false, true);
|
|
1854
1870
|
$i7OB2$createEffect(() => {
|
|
@@ -1916,9 +1932,28 @@ function $660070e2a394b3c3$export$e4b984597b71e989(props) {
|
|
|
1916
1932
|
// create a signal that's the same for all items in this listing
|
|
1917
1933
|
context[$660070e2a394b3c3$export$d7b7ab832c20e2f4] = $i7OB2$createSignal();
|
|
1918
1934
|
const [currentImageSize, setCurrentImageSize] = context?.[$660070e2a394b3c3$export$d7b7ab832c20e2f4] || $660070e2a394b3c3$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
|
|
1935
|
+
const aspectRatiosSet = context ?
|
|
1936
|
+
// If the context exists we have to create the set here as getting it here would be too late when it's created by ShopifyResponsiveImg below
|
|
1937
|
+
context[(0, $e8ffe11ed01df0fe$export$f8945274f08a3105)] ||= new (0, $i7OB2$ListenableSet)() : undefined;
|
|
1938
|
+
const [aspectRatios, setAspectRatios] = $i7OB2$createSignal(aspectRatiosSet, {
|
|
1939
|
+
equals: false
|
|
1940
|
+
});
|
|
1941
|
+
const aspectRatioToUse = $i7OB2$createMemo(() => {
|
|
1942
|
+
const aspectRatiosSet = aspectRatios(); // This signal "changes" to the same set every time the set changes, so we can use it as a dependency here
|
|
1943
|
+
useMostPrevalentAspectRatio: {
|
|
1944
|
+
if (!aspectRatiosSet || !props.autoAdjustAspectRatio) break useMostPrevalentAspectRatio;
|
|
1945
|
+
// Get the aspect ratio that most of the loaded images inside the ListingProvider we are, load
|
|
1946
|
+
const asArray = [...aspectRatiosSet].map(({
|
|
1947
|
+
aspectRatio_: aspectRatio_
|
|
1948
|
+
}) => aspectRatio_);
|
|
1949
|
+
const mostPrevalentAspectRatio = $i7OB2$findMostFrequentItem(asArray);
|
|
1950
|
+
if (mostPrevalentAspectRatio) return `var(${(0, $bb15dfb548a7666e$export$8a2234b5b1a5ebd4)}, ${mostPrevalentAspectRatio})`;
|
|
1951
|
+
}
|
|
1952
|
+
return props.aspectRatio;
|
|
1953
|
+
});
|
|
1919
1954
|
const container = $i7OB2$createComponent((0, $f18d425032111270$export$94026ee33dbabc26), {
|
|
1920
1955
|
get aspectRatio() {
|
|
1921
|
-
return
|
|
1956
|
+
return aspectRatioToUse();
|
|
1922
1957
|
},
|
|
1923
1958
|
get ["class"]() {
|
|
1924
1959
|
return props.class;
|
|
@@ -1927,6 +1962,10 @@ function $660070e2a394b3c3$export$e4b984597b71e989(props) {
|
|
|
1927
1962
|
const owner = $i7OB2$getOwner();
|
|
1928
1963
|
let createdSizeAccessor = false;
|
|
1929
1964
|
let wasCleanedUp = false;
|
|
1965
|
+
for (const event of ["add", "delete"]) {
|
|
1966
|
+
aspectRatiosSet?.addEventListener(event, () => setAspectRatios(aspectRatiosSet));
|
|
1967
|
+
$i7OB2$onCleanup(() => aspectRatiosSet?.removeEventListener(event, () => setAspectRatios(aspectRatiosSet)));
|
|
1968
|
+
}
|
|
1930
1969
|
$i7OB2$createEffect(() => {
|
|
1931
1970
|
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
1932
1971
|
// ensure we always have a size accessor
|
|
@@ -2756,7 +2795,8 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
|
|
|
2756
2795
|
get src() {
|
|
2757
2796
|
return props.src_;
|
|
2758
2797
|
},
|
|
2759
|
-
|
|
2798
|
+
autoAdjustAspectRatio: true,
|
|
2799
|
+
aspectRatio: 1
|
|
2760
2800
|
}),
|
|
2761
2801
|
...instant_results_options_
|
|
2762
2802
|
})));
|
|
@@ -2831,7 +2871,7 @@ const $024fbc0a2d796fad$var$TabsContext = /*@__PURE__*/$i7OB2$createContext();
|
|
|
2831
2871
|
const $024fbc0a2d796fad$var$useTabs = () => $i7OB2$useContext($024fbc0a2d796fad$var$TabsContext);
|
|
2832
2872
|
function $024fbc0a2d796fad$export$b2539bed5023c21c(props) {
|
|
2833
2873
|
return $i7OB2$createComponent($024fbc0a2d796fad$var$TabsContext.Provider, {
|
|
2834
|
-
value: new (0, $i7OB2$
|
|
2874
|
+
value: new (0, $i7OB2$ListenableSet1)(),
|
|
2835
2875
|
get children() {
|
|
2836
2876
|
return $i7OB2$createComponent($024fbc0a2d796fad$var$ActualTabs, $i7OB2$mergeProps(props, {
|
|
2837
2877
|
get children() {
|
|
@@ -2968,7 +3008,15 @@ async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_
|
|
|
2968
3008
|
const actually_close = () => {
|
|
2969
3009
|
dispose();
|
|
2970
3010
|
on_dispose?.();
|
|
2971
|
-
|
|
3011
|
+
const {
|
|
3012
|
+
activeElement: activeElement
|
|
3013
|
+
} = document;
|
|
3014
|
+
modal_els.forEach(el => {
|
|
3015
|
+
if (el.contains(activeElement))
|
|
3016
|
+
// Fix page jumping to the bottom when closing modal with scape after animation in safari
|
|
3017
|
+
activeElement?.blur?.();
|
|
3018
|
+
el.remove();
|
|
3019
|
+
});
|
|
2972
3020
|
};
|
|
2973
3021
|
if (animation_started && +new Date() - animation_started > 1000)
|
|
2974
3022
|
// Animation broke, close it this time
|
|
@@ -10147,7 +10195,7 @@ function $49de9d31aeea1b5e$export$6d0c9c22f6652669({
|
|
|
10147
10195
|
number_: num_results,
|
|
10148
10196
|
i18n_: i18n_
|
|
10149
10197
|
});
|
|
10150
|
-
const queries_without_content_results_ = new (0, $i7OB2$
|
|
10198
|
+
const queries_without_content_results_ = new (0, $i7OB2$ListenableSet)();
|
|
10151
10199
|
const [check_query, set_check_query] = $i7OB2$createSignal(false);
|
|
10152
10200
|
const placeholders_enabled = $i7OB2$createMemo(() => {
|
|
10153
10201
|
// don't show placeholders when the user toggles filters
|