@depict-ai/ui 4.1.8 → 4.2.0
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 +13558 -13093
- package/ES10/index.d.ts +272 -259
- package/ES10/index.js +13557 -13093
- package/latest/index.cjs +13796 -13338
- package/latest/index.d.ts +272 -259
- package/latest/index.js +13795 -13338
- package/package.json +4 -4
- package/server/ES10/index.cjs +12308 -11957
- package/server/ES10/index.d.ts +272 -259
- package/server/ES10/index.js +12307 -11957
- package/server/latest/index.cjs +7651 -7304
- package/server/latest/index.d.ts +272 -259
- package/server/latest/index.js +11336 -10990
package/ES10/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Display,
|
|
1
|
+
import { JSX, Accessor, Signal, Setter } from "solid-js";
|
|
2
|
+
import { Display, ColsAtSize, report, Amazing_Slider, ModernDisplay, Elem, TwoLetterMarket, Node_Array } from "@depict-ai/utilishared/ES10";
|
|
3
3
|
import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
|
|
4
4
|
import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
|
|
5
5
|
import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
@@ -10,13 +10,250 @@ 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 _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
|
|
13
|
-
export const version = "4.
|
|
13
|
+
export const version = "4.2.0";
|
|
14
|
+
declare const LISTING_ID = "listingId";
|
|
15
|
+
declare const EXTERNAL_ID = "externalId";
|
|
16
|
+
type ScrollRestorationData = {
|
|
17
|
+
min_results_loaded: number;
|
|
18
|
+
for_id: string;
|
|
19
|
+
}[];
|
|
20
|
+
export type SDKGridSpacing = string | {
|
|
21
|
+
horizontal: string;
|
|
22
|
+
vertical: string;
|
|
23
|
+
};
|
|
24
|
+
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
|
|
25
|
+
export type FilterWithData = WithRequired<SearchFilter, "data">;
|
|
26
|
+
export interface SDKRenderingInfo {
|
|
27
|
+
/**
|
|
28
|
+
* If you call this function with a provided function, the provided function will be called whenever the index of the currently displayed product changes.
|
|
29
|
+
*/
|
|
30
|
+
set_on_index_change: (fn: (index: number) => void) => void;
|
|
31
|
+
}
|
|
32
|
+
export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
|
|
33
|
+
type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
|
|
34
|
+
actual_field?: string;
|
|
35
|
+
})[] : never;
|
|
36
|
+
type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
|
|
37
|
+
export type SDKColsAtSize = [number, number?][];
|
|
38
|
+
/**
|
|
39
|
+
* Transform SDK ColsAtSize into valid Layout ColsAtSize
|
|
40
|
+
* @param cols_at_size [nbCol, maxWidth]
|
|
41
|
+
* @returns
|
|
42
|
+
*/
|
|
43
|
+
export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
|
|
44
|
+
/**
|
|
45
|
+
* 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.
|
|
46
|
+
*/
|
|
47
|
+
export function ProductCardIndexProvider(props: {
|
|
48
|
+
children: JSX.Element;
|
|
49
|
+
index_: Accessor<number>;
|
|
50
|
+
}): JSX.Element;
|
|
51
|
+
/**
|
|
52
|
+
* Use this to get an accessor containing the index of your product card.
|
|
53
|
+
*/
|
|
54
|
+
export function useProductCardIndex(): Accessor<number> | undefined;
|
|
14
55
|
/**
|
|
15
56
|
* This is a function that will safely clone an object that may contain promises.
|
|
16
57
|
* It will use structuredClone to clone the object and then re-apply (copy) any promises that were in the original object to the cloned object.
|
|
17
58
|
* @param obj Anything to clone
|
|
18
59
|
*/
|
|
19
60
|
export function promiseSafeStructuredClone<T>(obj: T): T;
|
|
61
|
+
declare class SDKError extends Error {}
|
|
62
|
+
export class ProductCardError extends SDKError {
|
|
63
|
+
constructor(templateError: Error);
|
|
64
|
+
}
|
|
65
|
+
export function SentryErrorBoundary(props: {
|
|
66
|
+
children: JSX.Element;
|
|
67
|
+
message_: string;
|
|
68
|
+
severity_: Parameters<typeof report>[1];
|
|
69
|
+
on_error_?: (retry: VoidFunction) => JSX.Element | void;
|
|
70
|
+
class_list_?: string[];
|
|
71
|
+
}): JSX.Element;
|
|
72
|
+
export type SolidLayoutOptions = {
|
|
73
|
+
cols_at_size: ColsAtSize;
|
|
74
|
+
grid_spacing: string;
|
|
75
|
+
rows: {
|
|
76
|
+
start_rows?: number;
|
|
77
|
+
rows_per_click?: number;
|
|
78
|
+
currently_visible?: Signal<number>;
|
|
79
|
+
max_rows?: number;
|
|
80
|
+
button?: JSX.Element;
|
|
81
|
+
view_less_button?: JSX.Element;
|
|
82
|
+
} | "all";
|
|
83
|
+
layout: "slider" | "grid";
|
|
84
|
+
disable_partial_rows?: boolean;
|
|
85
|
+
override_vertical_spacing?: string;
|
|
86
|
+
children: JSX.Element;
|
|
87
|
+
element_attributes: Omit<JSX.HTMLAttributes<HTMLDivElement>, "classList">;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* SolidLayout: SolidJS adaption of Layout. Calculates CSS for a grid or slider with a certain spacing and certain number of columns at certain screen sizes, including a view more button. All properties are reactive.
|
|
91
|
+
* @property rows if set to 'all': Just generate grid styling without any viewing/hiding functionality. If an object: start_rows is the number of rows at the beginning. rows_per_click is the amount of rows to view on each view more button click. button is the view more button to display. currently_visible is a signal that you can use to get and set the number of currently viewed rows
|
|
92
|
+
* @property cols_at_size An array with sub arrays looking like this: `[n_cols, min_width_media_query, max_width_media_query, grid_spacing_for_size]`, everything after `[n_cols, min_width]` is optional. falsey value for `min_width = no min_width`
|
|
93
|
+
* @property grid_spacing spacing to use if none is specified for the specific size in `cols_at_size`
|
|
94
|
+
* @property disable_partial_rows If set to `true`, will not let user press "show more" if next row is a partial row. Example of partial row: `cols_at_size` says we should have 4 recs in the next row, but we only have 2 left, so the row just gets 2 instead of 4, meaning it doesn't "fill out".
|
|
95
|
+
* @property override_vertical_spacing by default, the grid_spacing is used both horizontally and vertically, with this you can specify a separate spacing
|
|
96
|
+
* @return An accessor containing a CSS string
|
|
97
|
+
*/
|
|
98
|
+
export function SolidLayout(props: SolidLayoutOptions): JSX.Element;
|
|
99
|
+
/** @jsxImportSource solid-js */
|
|
100
|
+
export function GenericSliderArrowButton(props?: {
|
|
101
|
+
width_?: number;
|
|
102
|
+
height_?: number;
|
|
103
|
+
}): SVGElement;
|
|
104
|
+
export function SlidableItems({
|
|
105
|
+
children,
|
|
106
|
+
slider_ref_,
|
|
107
|
+
faded_opacity_,
|
|
108
|
+
mutation_plugins_,
|
|
109
|
+
disable_fading_,
|
|
110
|
+
arrow_width_,
|
|
111
|
+
arrow_height_,
|
|
112
|
+
snapAlign_,
|
|
113
|
+
fadingThreshold_
|
|
114
|
+
}: {
|
|
115
|
+
children?: JSX.Element;
|
|
116
|
+
slider_ref_?: (slider: Amazing_Slider) => any;
|
|
117
|
+
faded_opacity_?: number;
|
|
118
|
+
disable_fading_?: boolean;
|
|
119
|
+
snapAlign_?: "start" | "end" | "center";
|
|
120
|
+
fadingThreshold_?: number;
|
|
121
|
+
mutation_plugins_?: ((this: Amazing_Slider, mutations: IntersectionObserverEntry[], intersecting_items: Record<number, IntersectionObserverEntry>) => unknown)[];
|
|
122
|
+
arrow_width_?: number;
|
|
123
|
+
arrow_height_?: number;
|
|
124
|
+
}): JSX.Element;
|
|
125
|
+
/**
|
|
126
|
+
* Provider to wrap every listing (group of products) in
|
|
127
|
+
* Used for example for deduplicating ResizeObservers for responsive images
|
|
128
|
+
*/
|
|
129
|
+
export function ListingProvider(props: {
|
|
130
|
+
children: JSX.Element;
|
|
131
|
+
}): JSX.Element;
|
|
132
|
+
/**
|
|
133
|
+
* Use this to get the context object if your component is within a ListingProvider
|
|
134
|
+
*/
|
|
135
|
+
export function useListing(): Record<symbol, any> | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* Base placeholder component used by ImagePlaceholder and TextPlaceholder
|
|
138
|
+
*/
|
|
139
|
+
export function BasePlaceholder(props: {
|
|
140
|
+
style: JSX.CSSProperties;
|
|
141
|
+
class?: string;
|
|
142
|
+
}): JSX.Element;
|
|
143
|
+
type ImagePlaceholderBaseOptions = {
|
|
144
|
+
style?: JSX.CSSProperties;
|
|
145
|
+
class?: string;
|
|
146
|
+
};
|
|
147
|
+
type ImagePlaceholderBlockOptions = {
|
|
148
|
+
width: string;
|
|
149
|
+
height: string;
|
|
150
|
+
};
|
|
151
|
+
type ImagePlaceholderImageOptions = {
|
|
152
|
+
aspectRatio: number | string;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* A placeholder that can be used instead of an image or other block of content while it's loading.
|
|
156
|
+
* 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.
|
|
157
|
+
* @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
|
|
158
|
+
* @property width If width and height is set, the defined width and height will be used.
|
|
159
|
+
* @property height If width and height is set, the defined width and height will be used.
|
|
160
|
+
* @property class extra classes to add to the placeholder
|
|
161
|
+
* @property style extra styles to add to the placeholder
|
|
162
|
+
*/
|
|
163
|
+
export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
|
|
164
|
+
/**
|
|
165
|
+
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
166
|
+
*/
|
|
167
|
+
export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
|
|
168
|
+
/**
|
|
169
|
+
* Returns accessor with the size of the provided element, including padding and border (I think)
|
|
170
|
+
*/
|
|
171
|
+
export function make_accurate_width_accessor(what_to_watch: HTMLElement): import("solid-js").Accessor<number | undefined>;
|
|
172
|
+
/**
|
|
173
|
+
* A Placeholder to use instead of some text, while it's loading. This is the inline version, meant to be embedded into sentences (or exist instead of them), etc.
|
|
174
|
+
* If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
|
|
175
|
+
* @property height height of the placeholder. Set to `1em` by default.
|
|
176
|
+
* @property width width of the placeholder. For specific number of characters use `ch`, ex: `width="7ch"`
|
|
177
|
+
* @property class extra classes to add to the placeholder
|
|
178
|
+
* @property style extra styles to add to the placeholder
|
|
179
|
+
*/
|
|
180
|
+
export function TextPlaceholder(props: {
|
|
181
|
+
style?: JSX.CSSProperties;
|
|
182
|
+
height: string;
|
|
183
|
+
width: string;
|
|
184
|
+
class?: string;
|
|
185
|
+
}): JSX.Element;
|
|
186
|
+
export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
187
|
+
/**
|
|
188
|
+
* ImageContainer for using the padding hack to set the aspect ratio of an image
|
|
189
|
+
* Put this around an <img> or <ResponsiveImg> to give it a container that always has the same size as the image. This prevents CLS and enables ResponsiveImg to work (the browser to load the correct image size)
|
|
190
|
+
* (Not using the CSS aspect-ratio property yet here due to browser support)
|
|
191
|
+
*/
|
|
192
|
+
export function ImageContainer(props: {
|
|
193
|
+
aspectRatio: number | string;
|
|
194
|
+
class?: string;
|
|
195
|
+
children?: JSX.Element;
|
|
196
|
+
}): HTMLDivElement;
|
|
197
|
+
/**
|
|
198
|
+
* Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
|
|
199
|
+
*/
|
|
200
|
+
export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
|
|
201
|
+
/**
|
|
202
|
+
* Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
|
|
203
|
+
* Will also delay loading and decoding of image until the browser is idle (with 5s timeout) to improve filtering/loading more performance.
|
|
204
|
+
* 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").
|
|
205
|
+
* This is used for our responsive images:
|
|
206
|
+
* 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.
|
|
207
|
+
* 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
|
|
208
|
+
* 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.
|
|
209
|
+
* 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.
|
|
210
|
+
*/
|
|
211
|
+
export function ShopifyResponsiveImg(props: {
|
|
212
|
+
resolutions?: number[];
|
|
213
|
+
size: Accessor<number>;
|
|
214
|
+
src: string;
|
|
215
|
+
loading?: "eager" | "lazy" | "force-lazy";
|
|
216
|
+
customUrls?: (url: string, width: number) => string;
|
|
217
|
+
} & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes" | "loading">): JSX.Element;
|
|
218
|
+
export const shopifyContainedImageContextSymbol: unique symbol;
|
|
219
|
+
/**
|
|
220
|
+
* Abstraction built on top of ShopifyResponsiveImg. This is your one-stop-shop If you just need a responsive image.
|
|
221
|
+
* Will return a div of the provided aspect ratio that always has the same size, to avoid content layout shift. Will then put the image inside of the container once it loads.
|
|
222
|
+
* Also makes a responsive image without you having to do anything: uses shopify's CDN which picks the best image format to resize the image to the size of the first image container in a certain listing.
|
|
223
|
+
* This works because the listings (recs, search, plp) all are wrapped in `<ListingProvider>`'s. This means all components rendered within can use `useListing` to get an object to write data to that will be the same for all components rendered within that listing. The first instance of this component rendered within a listing puts a ResizeObserver on its div and the other components then just set the sizes attribute of their image to that.
|
|
224
|
+
* @property src image source
|
|
225
|
+
* @property aspectRatio aspect ratio of the image
|
|
226
|
+
* @property class extra class to add to the container
|
|
227
|
+
* @property alt alt text for the image
|
|
228
|
+
* @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. If set to "smoothed", the aspect ratio will only be allowed to update after a 500ms setTimeout has finished since the aspect ratio last updated. This is for use when the image size is being transitioned and the aspect ratio too, to not restart the CSS transitions every time the aspect ratio changes slightly.
|
|
229
|
+
* @property imgProps props to pass to ShopifyResponsiveImg to add to the <img> element
|
|
230
|
+
*/
|
|
231
|
+
export function ShopifyContainedImage(props: {
|
|
232
|
+
src: string;
|
|
233
|
+
aspectRatio: number | string;
|
|
234
|
+
autoAdjustAspectRatio?: boolean | "smoothed";
|
|
235
|
+
class?: string;
|
|
236
|
+
imgProps?: Omit<Parameters<typeof ShopifyResponsiveImg>[0], "size" | "src">;
|
|
237
|
+
}): HTMLDivElement;
|
|
238
|
+
/**
|
|
239
|
+
* Hacks ShopifyContainedImage work even for non-shopify image urls by forcing the format to be WebP
|
|
240
|
+
*/
|
|
241
|
+
export function ModernResponsiveContainedImage(props: Parameters<typeof ShopifyContainedImage>[0]): import("solid-js").JSX.Element;
|
|
242
|
+
/**
|
|
243
|
+
* Render a grid with provided recommendations. displayTransformers will not be applied for this since you yourself provide the displays. Options are reactive.
|
|
244
|
+
*/
|
|
245
|
+
export function LooksSlider(props: {
|
|
246
|
+
gridSpacing_: SDKGridSpacing;
|
|
247
|
+
columnsAtSize_: SDKColsAtSize;
|
|
248
|
+
productId_: string;
|
|
249
|
+
merchant_: string;
|
|
250
|
+
market_: string;
|
|
251
|
+
locale_: string;
|
|
252
|
+
title_?: JSX.Element;
|
|
253
|
+
FavoriteButton_?: (props: {
|
|
254
|
+
display_: ModernDisplay | null | undefined;
|
|
255
|
+
}) => JSX.Element;
|
|
256
|
+
}): HTMLDivElement;
|
|
20
257
|
export const prefixes_to_preserve_in_history_dot_state: Set<string>;
|
|
21
258
|
/**
|
|
22
259
|
* Prevent, usually SPAs, from deleting our stuff from history.state when they call history.pushState with a new object they have constructed. This will only run once no matter how often it's called.
|
|
@@ -82,29 +319,6 @@ export function createDeparallelizedNoDropResource<T, X>(dependency: Accessor<T
|
|
|
82
319
|
* @param fn the function to wrap
|
|
83
320
|
*/
|
|
84
321
|
export function throw_globally<T extends (...args: any) => any>(fn?: T): (...args: Parameters<T>) => ReturnType<T> | undefined;
|
|
85
|
-
declare const LISTING_ID = "listingId";
|
|
86
|
-
declare const EXTERNAL_ID = "externalId";
|
|
87
|
-
type ScrollRestorationData = {
|
|
88
|
-
min_results_loaded: number;
|
|
89
|
-
for_id: string;
|
|
90
|
-
}[];
|
|
91
|
-
export type SDKGridSpacing = string | {
|
|
92
|
-
horizontal: string;
|
|
93
|
-
vertical: string;
|
|
94
|
-
};
|
|
95
|
-
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
|
|
96
|
-
export type FilterWithData = WithRequired<SearchFilter, "data">;
|
|
97
|
-
export interface SDKRenderingInfo {
|
|
98
|
-
/**
|
|
99
|
-
* If you call this function with a provided function, the provided function will be called whenever the index of the currently displayed product changes.
|
|
100
|
-
*/
|
|
101
|
-
set_on_index_change: (fn: (index: number) => void) => void;
|
|
102
|
-
}
|
|
103
|
-
export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
|
|
104
|
-
type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
|
|
105
|
-
actual_field?: string;
|
|
106
|
-
})[] : never;
|
|
107
|
-
type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
|
|
108
322
|
type DisplayTransformerAlwaysThereData = {
|
|
109
323
|
merchant: string;
|
|
110
324
|
market: string;
|
|
@@ -323,40 +537,11 @@ export function SolidFormatPrice(props: {
|
|
|
323
537
|
places_after_comma_: number | "auto";
|
|
324
538
|
};
|
|
325
539
|
}): JSX.Element;
|
|
326
|
-
export type SDKColsAtSize = [number, number?][];
|
|
327
|
-
/**
|
|
328
|
-
* Transform SDK ColsAtSize into valid Layout ColsAtSize
|
|
329
|
-
* @param cols_at_size [nbCol, maxWidth]
|
|
330
|
-
* @returns
|
|
331
|
-
*/
|
|
332
|
-
export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
|
|
333
540
|
/**
|
|
334
541
|
* Disables scrolling until the solidjs reactive scoped is disposed (onCleanup)
|
|
335
542
|
* @returns A cleanup function to manually re-enable scrolling.
|
|
336
543
|
*/
|
|
337
544
|
export function disable_scrolling(): () => void;
|
|
338
|
-
declare class SDKError extends Error {}
|
|
339
|
-
export class ProductCardError extends SDKError {
|
|
340
|
-
constructor(templateError: Error);
|
|
341
|
-
}
|
|
342
|
-
export function SentryErrorBoundary(props: {
|
|
343
|
-
children: JSX.Element;
|
|
344
|
-
message_: string;
|
|
345
|
-
severity_: Parameters<typeof report>[1];
|
|
346
|
-
on_error_?: (retry: VoidFunction) => JSX.Element | void;
|
|
347
|
-
class_list_?: string[];
|
|
348
|
-
}): JSX.Element;
|
|
349
|
-
/**
|
|
350
|
-
* Provider to wrap every listing (group of products) in
|
|
351
|
-
* Used for example for deduplicating ResizeObservers for responsive images
|
|
352
|
-
*/
|
|
353
|
-
export function ListingProvider(props: {
|
|
354
|
-
children: JSX.Element;
|
|
355
|
-
}): JSX.Element;
|
|
356
|
-
/**
|
|
357
|
-
* Use this to get the context object if your component is within a ListingProvider
|
|
358
|
-
*/
|
|
359
|
-
export function useListing(): Record<symbol, any> | undefined;
|
|
360
545
|
/**
|
|
361
546
|
* Function that encodes a filter object into query parameters and sets them on the given URLSearchParams object.
|
|
362
547
|
*/
|
|
@@ -381,170 +566,6 @@ export function decode_sorting(search_params: URLSearchParams, sorting_query_par
|
|
|
381
566
|
* @param sorting_query_param
|
|
382
567
|
*/
|
|
383
568
|
export function strip_encoded_filter_and_sort(search_params: URLSearchParams, filter_query_param_prefix: string, sorting_query_param: string): void;
|
|
384
|
-
/**
|
|
385
|
-
* Base placeholder component used by ImagePlaceholder and TextPlaceholder
|
|
386
|
-
*/
|
|
387
|
-
export function BasePlaceholder(props: {
|
|
388
|
-
style: JSX.CSSProperties;
|
|
389
|
-
class?: string;
|
|
390
|
-
}): JSX.Element;
|
|
391
|
-
/**
|
|
392
|
-
* A Placeholder to use instead of some text, while it's loading. This is the inline version, meant to be embedded into sentences (or exist instead of them), etc.
|
|
393
|
-
* If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
|
|
394
|
-
* @property height height of the placeholder. Set to `1em` by default.
|
|
395
|
-
* @property width width of the placeholder. For specific number of characters use `ch`, ex: `width="7ch"`
|
|
396
|
-
* @property class extra classes to add to the placeholder
|
|
397
|
-
* @property style extra styles to add to the placeholder
|
|
398
|
-
*/
|
|
399
|
-
export function TextPlaceholder(props: {
|
|
400
|
-
style?: JSX.CSSProperties;
|
|
401
|
-
height: string;
|
|
402
|
-
width: string;
|
|
403
|
-
class?: string;
|
|
404
|
-
}): JSX.Element;
|
|
405
|
-
/**
|
|
406
|
-
* ImageContainer for using the padding hack to set the aspect ratio of an image
|
|
407
|
-
* Put this around an <img> or <ResponsiveImg> to give it a container that always has the same size as the image. This prevents CLS and enables ResponsiveImg to work (the browser to load the correct image size)
|
|
408
|
-
* (Not using the CSS aspect-ratio property yet here due to browser support)
|
|
409
|
-
*/
|
|
410
|
-
export function ImageContainer(props: {
|
|
411
|
-
aspectRatio: number | string;
|
|
412
|
-
class?: string;
|
|
413
|
-
children?: JSX.Element;
|
|
414
|
-
}): HTMLDivElement;
|
|
415
|
-
/**
|
|
416
|
-
* 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.
|
|
417
|
-
*/
|
|
418
|
-
export function ProductCardIndexProvider(props: {
|
|
419
|
-
children: JSX.Element;
|
|
420
|
-
index_: Accessor<number>;
|
|
421
|
-
}): JSX.Element;
|
|
422
|
-
/**
|
|
423
|
-
* Use this to get an accessor containing the index of your product card.
|
|
424
|
-
*/
|
|
425
|
-
export function useProductCardIndex(): Accessor<number> | undefined;
|
|
426
|
-
/**
|
|
427
|
-
* Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
|
|
428
|
-
*/
|
|
429
|
-
export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
|
|
430
|
-
/**
|
|
431
|
-
* Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
|
|
432
|
-
* Will also delay loading and decoding of image until the browser is idle (with 5s timeout) to improve filtering/loading more performance.
|
|
433
|
-
* 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").
|
|
434
|
-
* This is used for our responsive images:
|
|
435
|
-
* 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.
|
|
436
|
-
* 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
|
|
437
|
-
* 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.
|
|
438
|
-
* 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.
|
|
439
|
-
*/
|
|
440
|
-
export function ShopifyResponsiveImg(props: {
|
|
441
|
-
resolutions?: number[];
|
|
442
|
-
size: Accessor<number>;
|
|
443
|
-
src: string;
|
|
444
|
-
loading?: "eager" | "lazy" | "force-lazy";
|
|
445
|
-
customUrls?: (url: string, width: number) => string;
|
|
446
|
-
} & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes" | "loading">): JSX.Element;
|
|
447
|
-
type ImagePlaceholderBaseOptions = {
|
|
448
|
-
style?: JSX.CSSProperties;
|
|
449
|
-
class?: string;
|
|
450
|
-
};
|
|
451
|
-
type ImagePlaceholderBlockOptions = {
|
|
452
|
-
width: string;
|
|
453
|
-
height: string;
|
|
454
|
-
};
|
|
455
|
-
type ImagePlaceholderImageOptions = {
|
|
456
|
-
aspectRatio: number | string;
|
|
457
|
-
};
|
|
458
|
-
/**
|
|
459
|
-
* A placeholder that can be used instead of an image or other block of content while it's loading.
|
|
460
|
-
* 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.
|
|
461
|
-
* @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
|
|
462
|
-
* @property width If width and height is set, the defined width and height will be used.
|
|
463
|
-
* @property height If width and height is set, the defined width and height will be used.
|
|
464
|
-
* @property class extra classes to add to the placeholder
|
|
465
|
-
* @property style extra styles to add to the placeholder
|
|
466
|
-
*/
|
|
467
|
-
export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
|
|
468
|
-
export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
469
|
-
export const shopifyContainedImageContextSymbol: unique symbol;
|
|
470
|
-
/**
|
|
471
|
-
* Abstraction built on top of ShopifyResponsiveImg. This is your one-stop-shop If you just need a responsive image.
|
|
472
|
-
* Will return a div of the provided aspect ratio that always has the same size, to avoid content layout shift. Will then put the image inside of the container once it loads.
|
|
473
|
-
* Also makes a responsive image without you having to do anything: uses shopify's CDN which picks the best image format to resize the image to the size of the first image container in a certain listing.
|
|
474
|
-
* This works because the listings (recs, search, plp) all are wrapped in `<ListingProvider>`'s. This means all components rendered within can use `useListing` to get an object to write data to that will be the same for all components rendered within that listing. The first instance of this component rendered within a listing puts a ResizeObserver on its div and the other components then just set the sizes attribute of their image to that.
|
|
475
|
-
* @property src image source
|
|
476
|
-
* @property aspectRatio aspect ratio of the image
|
|
477
|
-
* @property class extra class to add to the container
|
|
478
|
-
* @property alt alt text for the image
|
|
479
|
-
* @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
|
|
480
|
-
* @property imgProps props to pass to ShopifyResponsiveImg to add to the <img> element
|
|
481
|
-
*/
|
|
482
|
-
export function ShopifyContainedImage(props: {
|
|
483
|
-
src: string;
|
|
484
|
-
aspectRatio: number | string;
|
|
485
|
-
autoAdjustAspectRatio?: boolean;
|
|
486
|
-
class?: string;
|
|
487
|
-
imgProps?: Omit<Parameters<typeof ShopifyResponsiveImg>[0], "size" | "src">;
|
|
488
|
-
}): HTMLDivElement;
|
|
489
|
-
/**
|
|
490
|
-
* Hacks ShopifyContainedImage work even for non-shopify image urls by forcing the format to be WebP
|
|
491
|
-
*/
|
|
492
|
-
export function ModernResponsiveContainedImage(props: {
|
|
493
|
-
merchant_: string;
|
|
494
|
-
} & Parameters<typeof ShopifyContainedImage>[0]): import("solid-js").JSX.Element;
|
|
495
|
-
/** @jsxImportSource solid-js */
|
|
496
|
-
export function GenericSliderArrowButton(props?: {
|
|
497
|
-
width_?: number;
|
|
498
|
-
height_?: number;
|
|
499
|
-
}): SVGElement;
|
|
500
|
-
export function SlidableItems({
|
|
501
|
-
children,
|
|
502
|
-
slider_ref_,
|
|
503
|
-
faded_opacity_,
|
|
504
|
-
mutation_plugins_,
|
|
505
|
-
disable_fading_,
|
|
506
|
-
arrow_width_,
|
|
507
|
-
arrow_height_,
|
|
508
|
-
snapAlign_,
|
|
509
|
-
fadingThreshold_
|
|
510
|
-
}: {
|
|
511
|
-
children?: JSX.Element;
|
|
512
|
-
slider_ref_?: (slider: Amazing_Slider) => any;
|
|
513
|
-
faded_opacity_?: number;
|
|
514
|
-
disable_fading_?: boolean;
|
|
515
|
-
snapAlign_?: "start" | "end" | "center";
|
|
516
|
-
fadingThreshold_?: number;
|
|
517
|
-
mutation_plugins_?: ((this: Amazing_Slider, mutations: IntersectionObserverEntry[], intersecting_items: Record<number, IntersectionObserverEntry>) => unknown)[];
|
|
518
|
-
arrow_width_?: number;
|
|
519
|
-
arrow_height_?: number;
|
|
520
|
-
}): JSX.Element;
|
|
521
|
-
export type SolidLayoutOptions = {
|
|
522
|
-
cols_at_size: ColsAtSize;
|
|
523
|
-
grid_spacing: string;
|
|
524
|
-
rows: {
|
|
525
|
-
start_rows?: number;
|
|
526
|
-
rows_per_click?: number;
|
|
527
|
-
currently_visible?: Signal<number>;
|
|
528
|
-
max_rows?: number;
|
|
529
|
-
button?: JSX.Element;
|
|
530
|
-
view_less_button?: JSX.Element;
|
|
531
|
-
} | "all";
|
|
532
|
-
layout: "slider" | "grid";
|
|
533
|
-
disable_partial_rows?: boolean;
|
|
534
|
-
override_vertical_spacing?: string;
|
|
535
|
-
children: JSX.Element;
|
|
536
|
-
element_attributes: Omit<JSX.HTMLAttributes<HTMLDivElement>, "classList">;
|
|
537
|
-
};
|
|
538
|
-
/**
|
|
539
|
-
* SolidLayout: SolidJS adaption of Layout. Calculates CSS for a grid or slider with a certain spacing and certain number of columns at certain screen sizes, including a view more button. All properties are reactive.
|
|
540
|
-
* @property rows if set to 'all': Just generate grid styling without any viewing/hiding functionality. If an object: start_rows is the number of rows at the beginning. rows_per_click is the amount of rows to view on each view more button click. button is the view more button to display. currently_visible is a signal that you can use to get and set the number of currently viewed rows
|
|
541
|
-
* @property cols_at_size An array with sub arrays looking like this: `[n_cols, min_width_media_query, max_width_media_query, grid_spacing_for_size]`, everything after `[n_cols, min_width]` is optional. falsey value for `min_width = no min_width`
|
|
542
|
-
* @property grid_spacing spacing to use if none is specified for the specific size in `cols_at_size`
|
|
543
|
-
* @property disable_partial_rows If set to `true`, will not let user press "show more" if next row is a partial row. Example of partial row: `cols_at_size` says we should have 4 recs in the next row, but we only have 2 left, so the row just gets 2 instead of 4, meaning it doesn't "fill out".
|
|
544
|
-
* @property override_vertical_spacing by default, the grid_spacing is used both horizontally and vertically, with this you can specify a separate spacing
|
|
545
|
-
* @return An accessor containing a CSS string
|
|
546
|
-
*/
|
|
547
|
-
export function SolidLayout(props: SolidLayoutOptions): JSX.Element;
|
|
548
569
|
export function CrossIcon(props?: JSX.SvgSVGAttributes<SVGSVGElement>): SVGElement;
|
|
549
570
|
interface Styles {
|
|
550
571
|
[selector: string]: JSX.CSSProperties;
|
|
@@ -802,10 +823,6 @@ declare class PseudoRouter {
|
|
|
802
823
|
};
|
|
803
824
|
constructor(on_navigation: OnNavigation, listing_query_state_key?: string);
|
|
804
825
|
}
|
|
805
|
-
/**
|
|
806
|
-
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
807
|
-
*/
|
|
808
|
-
export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
|
|
809
826
|
/**
|
|
810
827
|
* First generation (classic) search modal - the solid component that gets added to <body> when the search modal is opened
|
|
811
828
|
*/
|
|
@@ -993,10 +1010,6 @@ export type ContentBlock = {
|
|
|
993
1010
|
* ```
|
|
994
1011
|
*/
|
|
995
1012
|
export type ContentBlocksByRow = (undefined | ContentBlock)[];
|
|
996
|
-
/**
|
|
997
|
-
* Returns accessor with the size of the provided element, including padding and border (I think)
|
|
998
|
-
*/
|
|
999
|
-
export function make_accurate_width_accessor(what_to_watch: HTMLElement): import("solid-js").Accessor<number | undefined>;
|
|
1000
1013
|
/**
|
|
1001
1014
|
* Render a grid with provided recommendations. displayTransformers will not be applied for this since you yourself provide the displays. Options are reactive.
|
|
1002
1015
|
*/
|
|
@@ -1174,6 +1187,10 @@ export const embedded_num_products: ({
|
|
|
1174
1187
|
middle_elements_: Accessor<JSX.Element>;
|
|
1175
1188
|
on_filters_constructed_: () => void;
|
|
1176
1189
|
};
|
|
1190
|
+
/**
|
|
1191
|
+
* Gets available listings for a given merchant, market and locale
|
|
1192
|
+
*/
|
|
1193
|
+
export function get_listings(merchant: string, market: string, locale: string): Promise<import("@depict-ai/types/api/ListListingsResponseItem").ListListingsResponseItem1[]>;
|
|
1177
1194
|
type GeneralCategoryListingOptions = {
|
|
1178
1195
|
market: string;
|
|
1179
1196
|
merchant: string;
|
|
@@ -1236,37 +1253,6 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
|
|
|
1236
1253
|
...props_on_class
|
|
1237
1254
|
}: DepictCategoryConstructorOptions<InputDisplay, OutputDisplay>);
|
|
1238
1255
|
}
|
|
1239
|
-
/**
|
|
1240
|
-
* This is the CategoryPage component visible outside - exported from @depict-ai/ui.
|
|
1241
|
-
* It wraps the internal, pure CategoryPage component and connects it to the DepictCategory instance and other global state such as the history or page URL.
|
|
1242
|
-
* It is wrapped once again in the js-ui and react-ui packages which exports the final, most simplified interface.
|
|
1243
|
-
*/
|
|
1244
|
-
export function CategoryPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: {
|
|
1245
|
-
depict_category: DepictCategory<OriginalDisplay, OutputDisplay>;
|
|
1246
|
-
grid_spacing: SDKGridSpacing;
|
|
1247
|
-
cols_at_size: SDKColsAtSize;
|
|
1248
|
-
product_card_template: ProductCardTemplate<[OutputDisplay] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>;
|
|
1249
|
-
show_quicklinks?: boolean;
|
|
1250
|
-
show_breadcrumbs?: boolean;
|
|
1251
|
-
category_title: typeof CategoryTitle | typeof embedded_num_products;
|
|
1252
|
-
on_listing_query_change?: (new_listing_query?: ListingQuery | undefined, old_listing_query?: ListingQuery | undefined) => void;
|
|
1253
|
-
content_blocks_by_row?: ContentBlocksByRow;
|
|
1254
|
-
layout?: PossibleLayout;
|
|
1255
|
-
}): import("@depict-ai/utilishared").Node_Array;
|
|
1256
|
-
export function BreadCrumbs<T extends Display>({
|
|
1257
|
-
depict_category
|
|
1258
|
-
}: {
|
|
1259
|
-
depict_category: DepictCategory<T>;
|
|
1260
|
-
}): HTMLDivElement;
|
|
1261
|
-
export function QuickLinks<T extends Display>({
|
|
1262
|
-
depict_category
|
|
1263
|
-
}: {
|
|
1264
|
-
depict_category: DepictCategory<T>;
|
|
1265
|
-
}): HTMLDivElement;
|
|
1266
|
-
/**
|
|
1267
|
-
* Gets available listings for a given merchant, market and locale
|
|
1268
|
-
*/
|
|
1269
|
-
export function get_listings(merchant: string, market: string, locale: string): Promise<import("@depict-ai/types/api/ListListingsResponseItem").ListListingsResponseItem1[]>;
|
|
1270
1256
|
/** A function that renders category suggestion cards. Set to false to disable category suggestions. */
|
|
1271
1257
|
export type RenderCategorySuggestion = (category_suggestion: Accessor<ListingSuggestionAfterURLCreator>, index: number) => JSX.Element;
|
|
1272
1258
|
type GeneralConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
|
|
@@ -1392,7 +1378,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
|
|
|
1392
1378
|
* Open the modal with support for alignment.
|
|
1393
1379
|
* @returns {void}
|
|
1394
1380
|
*/
|
|
1395
|
-
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends
|
|
1381
|
+
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends ModernDisplay>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
|
|
1396
1382
|
export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
|
|
1397
1383
|
export interface PageReplacer {
|
|
1398
1384
|
readonly render_: () => Node_Array;
|
|
@@ -1443,4 +1429,31 @@ interface SearchFieldParams {
|
|
|
1443
1429
|
* Returns a SearchField that will open a modal aligned to it when clicked.
|
|
1444
1430
|
*/
|
|
1445
1431
|
export function SearchField(props: SearchFieldParams): HTMLDivElement[];
|
|
1432
|
+
export function BreadCrumbs<T extends Display>({
|
|
1433
|
+
depict_category
|
|
1434
|
+
}: {
|
|
1435
|
+
depict_category: DepictCategory<T>;
|
|
1436
|
+
}): HTMLDivElement;
|
|
1437
|
+
export function QuickLinks<T extends Display>({
|
|
1438
|
+
depict_category
|
|
1439
|
+
}: {
|
|
1440
|
+
depict_category: DepictCategory<T>;
|
|
1441
|
+
}): HTMLDivElement;
|
|
1442
|
+
/**
|
|
1443
|
+
* This is the CategoryPage component visible outside - exported from @depict-ai/ui.
|
|
1444
|
+
* It wraps the internal, pure CategoryPage component and connects it to the DepictCategory instance and other global state such as the history or page URL.
|
|
1445
|
+
* It is wrapped once again in the js-ui and react-ui packages which exports the final, most simplified interface.
|
|
1446
|
+
*/
|
|
1447
|
+
export function CategoryPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: {
|
|
1448
|
+
depict_category: DepictCategory<OriginalDisplay, OutputDisplay>;
|
|
1449
|
+
grid_spacing: SDKGridSpacing;
|
|
1450
|
+
cols_at_size: SDKColsAtSize;
|
|
1451
|
+
product_card_template: ProductCardTemplate<[OutputDisplay] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>;
|
|
1452
|
+
show_quicklinks?: boolean;
|
|
1453
|
+
show_breadcrumbs?: boolean;
|
|
1454
|
+
category_title: typeof CategoryTitle | typeof embedded_num_products;
|
|
1455
|
+
on_listing_query_change?: (new_listing_query?: ListingQuery | undefined, old_listing_query?: ListingQuery | undefined) => void;
|
|
1456
|
+
content_blocks_by_row?: ContentBlocksByRow;
|
|
1457
|
+
layout?: PossibleLayout;
|
|
1458
|
+
}): import("@depict-ai/utilishared/latest").Node_Array;
|
|
1446
1459
|
export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";
|