@depict-ai/ui 2.0.25 → 2.1.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 +489 -114
- package/ES10/index.d.ts +75 -45
- package/ES10/index.js +490 -115
- package/latest/index.cjs +458 -106
- package/latest/index.d.ts +75 -45
- package/latest/index.js +459 -107
- package/locales/require.js +1152 -0
- package/package.json +4 -4
- package/server/ES10/index.cjs +460 -114
- package/server/ES10/index.d.ts +75 -45
- package/server/ES10/index.js +461 -115
- package/server/latest/index.cjs +429 -106
- package/server/latest/index.d.ts +75 -45
- package/server/latest/index.js +430 -107
package/ES10/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX, Accessor, Signal, Setter } from "solid-js";
|
|
2
|
-
import { Display, Amazing_Slider, ColsAtSize,
|
|
2
|
+
import { report, Display, Amazing_Slider, ColsAtSize, Elem, ModernDisplay, Node_Array } from "@depict-ai/utilishared/ES10";
|
|
3
3
|
import { SearchFilter, SearchRequest } from "@depict-ai/types/api/SearchRequest";
|
|
4
4
|
import { SearchFilter as _SearchFilter1, ContentLink, SearchResponse } from "@depict-ai/types/api/SearchResponse";
|
|
5
5
|
import { BaseCategoryDisplay, ProductListingResponse } from "@depict-ai/types/api/ProductListingResponse";
|
|
@@ -7,7 +7,78 @@ import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/
|
|
|
7
7
|
import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
|
|
8
8
|
import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
|
|
9
9
|
import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
|
|
10
|
-
export const version = "2.0
|
|
10
|
+
export const version = "2.1.0";
|
|
11
|
+
/**
|
|
12
|
+
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
13
|
+
*/
|
|
14
|
+
export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
|
|
15
|
+
declare class SDKError extends Error {}
|
|
16
|
+
export class ProductCardError extends SDKError {
|
|
17
|
+
constructor(templateError: Error);
|
|
18
|
+
}
|
|
19
|
+
export function SentryErrorBoundary(props: {
|
|
20
|
+
children: JSX.Element;
|
|
21
|
+
message_: string;
|
|
22
|
+
severity_: Parameters<typeof report>[1];
|
|
23
|
+
on_error_?: (retry: VoidFunction) => void;
|
|
24
|
+
class_list_?: string[];
|
|
25
|
+
}): JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* Base placeholder component used by ImagePlaceholder and TextPlaceholder
|
|
28
|
+
*/
|
|
29
|
+
export function BasePlaceholder(props: {
|
|
30
|
+
style: JSX.CSSProperties;
|
|
31
|
+
class?: string;
|
|
32
|
+
}): JSX.Element;
|
|
33
|
+
type ImagePlaceholderBaseOptions = {
|
|
34
|
+
style?: JSX.CSSProperties;
|
|
35
|
+
class?: string;
|
|
36
|
+
};
|
|
37
|
+
type ImagePlaceholderBlockOptions = {
|
|
38
|
+
width: string;
|
|
39
|
+
height: string;
|
|
40
|
+
};
|
|
41
|
+
type ImagePlaceholderImageOptions = {
|
|
42
|
+
aspectRatio: number;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* A placeholder that can be used instead of an image or other block of content while it's loading.
|
|
46
|
+
* 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.
|
|
47
|
+
* @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
|
|
48
|
+
* @property width If width and height is set, the defined width and height will be used.
|
|
49
|
+
* @property height If width and height is set, the defined width and height will be used.
|
|
50
|
+
* @property class extra classes to add to the placeholder
|
|
51
|
+
* @property style extra styles to add to the placeholder
|
|
52
|
+
*/
|
|
53
|
+
export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
|
|
54
|
+
/**
|
|
55
|
+
* The interface for a content block.
|
|
56
|
+
* Please make sure that you don't have content blocks overlap as that will cause undefined behavior.
|
|
57
|
+
* The height of the content block will be the height of the tallest item in a row, so if there are no products in a row the content block needs to "bring its own height".
|
|
58
|
+
* If you need to load any data in the content block, please make sure to return a placeholder while you're doing so, to avoid layout shifts and ensure scroll restoration works correctly.
|
|
59
|
+
*
|
|
60
|
+
* - `span_columns`: How many columns the block should span. This will be capped to the number of columns available.
|
|
61
|
+
* - `span_rows`: How many rows the block should span.
|
|
62
|
+
* - `position`: Where the block should be positioned. Can be `left`, `center` or `right`.
|
|
63
|
+
* - `content`: The content to render in the block - please provide a function returning one or multiple HTML elements.
|
|
64
|
+
*/
|
|
65
|
+
export type ContentBlock = {
|
|
66
|
+
span_columns: number;
|
|
67
|
+
span_rows: number;
|
|
68
|
+
position: "left" | "center" | "right";
|
|
69
|
+
content: () => JSX.Element | Promise<JSX.Element>;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* A sparse array containing content blocks to show (or an empty slot or undefined if there's no block at that index). See ContentBlock for how a content block looks like. The index is the row where the content block should be shown.
|
|
73
|
+
* For example, to create a block on row 1 and 3 you'd do `[, block1, , block2]`.
|
|
74
|
+
* Alternatively:
|
|
75
|
+
* ```
|
|
76
|
+
* const blocks = [];
|
|
77
|
+
* blocks[1] = block1;
|
|
78
|
+
* blocks[3] = block2;
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export type ContentBlocksByRow = (undefined | ContentBlock)[];
|
|
11
82
|
export type SDKGridSpacing = string | {
|
|
12
83
|
horizontal: string;
|
|
13
84
|
vertical: string;
|
|
@@ -138,17 +209,6 @@ export type SDKColsAtSize = [number, number?][];
|
|
|
138
209
|
* @returns
|
|
139
210
|
*/
|
|
140
211
|
export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
|
|
141
|
-
declare class SDKError extends Error {}
|
|
142
|
-
export class ProductCardError extends SDKError {
|
|
143
|
-
constructor(templateError: Error);
|
|
144
|
-
}
|
|
145
|
-
export function SentryErrorBoundary(props: {
|
|
146
|
-
children: JSX.Element;
|
|
147
|
-
message_: string;
|
|
148
|
-
severity_: Parameters<typeof report>[1];
|
|
149
|
-
on_error_?: (retry: VoidFunction) => void;
|
|
150
|
-
class_list_?: string[];
|
|
151
|
-
}): JSX.Element;
|
|
152
212
|
export type SolidLayoutOptions = {
|
|
153
213
|
cols_at_size: ColsAtSize;
|
|
154
214
|
grid_spacing: string;
|
|
@@ -358,13 +418,6 @@ export function SelectedFilters({
|
|
|
358
418
|
selected_filters_: Signal<FilterWithData[]>;
|
|
359
419
|
local_filter_cache_: Signal<SearchFilter[]>;
|
|
360
420
|
}): HTMLDivElement;
|
|
361
|
-
/**
|
|
362
|
-
* Base placeholder component used by ImagePlaceholder and TextPlaceholder
|
|
363
|
-
*/
|
|
364
|
-
export function BasePlaceholder(props: {
|
|
365
|
-
style: JSX.CSSProperties;
|
|
366
|
-
class?: string;
|
|
367
|
-
}): JSX.Element;
|
|
368
421
|
/**
|
|
369
422
|
* 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.
|
|
370
423
|
* If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
|
|
@@ -626,10 +679,6 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
|
|
|
626
679
|
failed?: true | undefined;
|
|
627
680
|
}>;
|
|
628
681
|
}
|
|
629
|
-
/**
|
|
630
|
-
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
631
|
-
*/
|
|
632
|
-
export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
|
|
633
682
|
/**
|
|
634
683
|
* Disables scrolling until the solidjs reactive scoped is disposed (onCleanup)
|
|
635
684
|
* @returns A cleanup function to manually re-enable scrolling.
|
|
@@ -729,6 +778,7 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
|
|
|
729
778
|
show_breadcrumbs?: boolean;
|
|
730
779
|
category_title: typeof CategoryTitle | typeof embedded_num_products;
|
|
731
780
|
on_query_id_change?: (new_query_id?: string | undefined, old_query_id?: string | undefined) => void;
|
|
781
|
+
content_blocks_by_row?: ContentBlocksByRow;
|
|
732
782
|
}): import("@depict-ai/utilishared").Node_Array;
|
|
733
783
|
export function BreadCrumbs<T extends Display>({
|
|
734
784
|
depict_category
|
|
@@ -747,27 +797,6 @@ export function QuickLinks<T extends Display>({
|
|
|
747
797
|
* @param type - optional, currently only setting this to "collection" will return collections instead of categories
|
|
748
798
|
*/
|
|
749
799
|
export function get_categories(tenant: string, market: string, type?: string): Promise<string[]>;
|
|
750
|
-
type ImagePlaceholderBaseOptions = {
|
|
751
|
-
style?: JSX.CSSProperties;
|
|
752
|
-
class?: string;
|
|
753
|
-
};
|
|
754
|
-
type ImagePlaceholderBlockOptions = {
|
|
755
|
-
width: string;
|
|
756
|
-
height: string;
|
|
757
|
-
};
|
|
758
|
-
type ImagePlaceholderImageOptions = {
|
|
759
|
-
aspectRatio: number;
|
|
760
|
-
};
|
|
761
|
-
/**
|
|
762
|
-
* A placeholder that can be used instead of an image or other block of content while it's loading.
|
|
763
|
-
* 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.
|
|
764
|
-
* @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
|
|
765
|
-
* @property width If width and height is set, the defined width and height will be used.
|
|
766
|
-
* @property height If width and height is set, the defined width and height will be used.
|
|
767
|
-
* @property class extra classes to add to the placeholder
|
|
768
|
-
* @property style extra styles to add to the placeholder
|
|
769
|
-
*/
|
|
770
|
-
export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
|
|
771
800
|
export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
772
801
|
/**
|
|
773
802
|
* Useful for aligning the search modal to an element, like an existing input field
|
|
@@ -871,6 +900,7 @@ export function SearchPage<OriginalDisplay extends Display, TransformedDisplay e
|
|
|
871
900
|
grid_spacing: SDKGridSpacing;
|
|
872
901
|
cols_at_size: SDKColsAtSize;
|
|
873
902
|
product_card_template: ProductCardTemplate<[TransformedDisplay] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<TransformedDisplay>>;
|
|
903
|
+
content_blocks_by_row?: ContentBlocksByRow;
|
|
874
904
|
on_query_change?: (new_query?: string | undefined, old_query?: string | undefined) => void;
|
|
875
905
|
extra_depict_options?: {
|
|
876
906
|
recommendations_cols_at_size?: SDKColsAtSize;
|