@depict-ai/ui 2.0.14 → 2.0.15

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/latest/index.cjs CHANGED
@@ -10,6 +10,10 @@ function $parcel$export(e, n, v, s) {
10
10
  configurable: true
11
11
  });
12
12
  }
13
+ $parcel$export(module.exports, "shopifyContainedImageContextSymbol", () => $a33065cfed827fc0$export$d7b7ab832c20e2f4);
14
+ $parcel$export(module.exports, "ListingProvider", () => $84798aaa863a4909$export$e68cff63f76bd15b);
15
+ $parcel$export(module.exports, "useListing", () => $84798aaa863a4909$export$8d0c4fdbb05a2f2e);
16
+ $parcel$export(module.exports, "ShopifyContainedImage", () => $a33065cfed827fc0$export$e4b984597b71e989);
13
17
  $parcel$export(module.exports, "SlidableItems", () => $a0e53f99354809d9$export$6649caad96ef8870);
14
18
  $parcel$export(module.exports, "make_accurate_size_accessor", () => $e5f442fb78c98741$export$9f191182275e9ef);
15
19
  $parcel$export(module.exports, "RecommendationSlider", () => $72f96c4782db0b1b$export$9574e176201e5e8d);
@@ -62,7 +66,133 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
62
66
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
63
67
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
64
68
  /*! Depict.ai search and product listing SDK */
65
- const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.14";
69
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.15";
70
+ const $84798aaa863a4909$var$ListingContext = /*@__PURE__*/$gVhhF$solidjs.createContext();
71
+ function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
72
+ const our_object = {};
73
+ return $gVhhF$solidjsweb.createComponent($84798aaa863a4909$var$ListingContext.Provider, {
74
+ value: our_object,
75
+ get children() {
76
+ return props.children;
77
+ }
78
+ });
79
+ }
80
+ function $84798aaa863a4909$export$8d0c4fdbb05a2f2e() {
81
+ return $gVhhF$solidjs.useContext($84798aaa863a4909$var$ListingContext);
82
+ }
83
+ const $93304d59a9747aa6$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
84
+ function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
85
+ return (() => {
86
+ const _el$ = $gVhhF$solidjsweb.getNextElement($93304d59a9747aa6$var$_tmpl$);
87
+ $gVhhF$solidjsweb.effect(_$p => $gVhhF$solidjsweb.style(_el$, `position:relative;width:100%;padding-bottom:${1 / props.aspectRatio * 100}%`, _$p));
88
+ return _el$;
89
+ })();
90
+ }
91
+ const $19950faaac026e09$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<img>`, 1);
92
+ function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
93
+ const [size, setSize] = $gVhhF$solidjs.createSignal(0);
94
+ const resizeObserver = new ResizeObserver($gVhhF$depictaiutilishared.catchify(records => {
95
+ for (let j = 0; j < records.length; j++) {
96
+ const {
97
+ width: width
98
+ } = records[j].contentRect;
99
+ if (!width) continue;
100
+ // add extra 5% just in case. + safari is (in some cases) acting a bit questionable and needs a third extra to fill the set width
101
+ const new_size = width * 1.05 * ((0, $gVhhF$depictaiutilishared.is_safari) ? 4 / 3 : 1);
102
+ setSize(Math.round(new_size));
103
+ }
104
+ }));
105
+ // If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
106
+ // It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
107
+ const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists(whatToWatch, ({
108
+ element: element
109
+ }) => requestAnimationFrame($gVhhF$depictaiutilishared.catchify(() => resizeObserver.observe(element))));
110
+ $gVhhF$solidjs.onCleanup(() => {
111
+ resizeObserver.disconnect();
112
+ disconnect();
113
+ });
114
+ return size;
115
+ }
116
+ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
117
+ // Enable reactive props
118
+ const otherOptions = $gVhhF$solidjs.createMemo(() => {
119
+ const cloned_props = {
120
+ ...props
121
+ };
122
+ delete cloned_props.resolutions;
123
+ // @ts-ignore
124
+ delete cloned_props.size;
125
+ // @ts-ignore
126
+ delete cloned_props.src;
127
+ return cloned_props;
128
+ });
129
+ const src_options = $gVhhF$solidjs.createMemo(() => {
130
+ const src = new URL(props.src, location.origin);
131
+ const fallback_src = $19950faaac026e09$var$generateImageUrl(src, 400);
132
+ const srcset = $19950faaac026e09$var$make_srcset(src, props.resolutions || [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096]);
133
+ return {
134
+ src: fallback_src,
135
+ srcset: srcset
136
+ };
137
+ });
138
+ return (() => {
139
+ const _el$ = $gVhhF$solidjsweb.getNextElement($19950faaac026e09$var$_tmpl$);
140
+ $gVhhF$solidjsweb.spread(_el$, $gVhhF$solidjsweb.mergeProps(otherOptions, src_options, {
141
+ get sizes() {
142
+ return props.size() + "px";
143
+ }
144
+ }), false, false);
145
+ $gVhhF$solidjsweb.runHydrationEvents();
146
+ return _el$;
147
+ })();
148
+ }
149
+ function $19950faaac026e09$var$make_srcset(url, resolutions) {
150
+ return resolutions.map(width => `${$19950faaac026e09$var$generateImageUrl(url, width)} ${width}w`).join(", ");
151
+ }
152
+ function $19950faaac026e09$var$generateImageUrl(url, width) {
153
+ url.searchParams.set("width", width);
154
+ return url.href;
155
+ }
156
+ const $a33065cfed827fc0$var$backupSizeSignal = /*@__PURE__*/$gVhhF$solidjs.createSignal();
157
+ const $a33065cfed827fc0$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
158
+ function $a33065cfed827fc0$export$e4b984597b71e989(props) {
159
+ const context = $84798aaa863a4909$export$8d0c4fdbb05a2f2e();
160
+ if (context && !context[$a33065cfed827fc0$export$d7b7ab832c20e2f4])
161
+ // create a signal that's the same for all items in this listing
162
+ context[$a33065cfed827fc0$export$d7b7ab832c20e2f4] = $gVhhF$solidjs.createSignal();
163
+ $gVhhF$depictaiutilishared.dlog("Checking for", $a33065cfed827fc0$export$d7b7ab832c20e2f4, "in", context);
164
+ const [currentImageSize, setCurrentImageSize] = context?.[$a33065cfed827fc0$export$d7b7ab832c20e2f4] || $a33065cfed827fc0$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
165
+ const container = $gVhhF$solidjsweb.createComponent((0, $93304d59a9747aa6$export$94026ee33dbabc26), {
166
+ get aspectRatio() {
167
+ return props.aspectRatio;
168
+ }
169
+ });
170
+ const owner = $gVhhF$solidjs.getOwner();
171
+ let createdSizeAccessor = false;
172
+ let wasCleanedUp = false;
173
+ $gVhhF$solidjs.createEffect(() => {
174
+ if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
175
+ // ensure we always have a size accessor
176
+ // what this whole thing does is set the sizes attribute to the actual size of one of the existing image containers, therefore the value doesn't have to manually be specified
177
+ setCurrentImageSize(() => $gVhhF$solidjs.runWithOwner(owner, () => $19950faaac026e09$export$e6fffe67d4cdd848(container)));
178
+ });
179
+ $gVhhF$solidjs.onCleanup(() => {
180
+ wasCleanedUp = true; // important to set this before the function call below and always, so the dead effects don't create dead size accessors
181
+ if (!createdSizeAccessor) return;
182
+ $gVhhF$depictaiutilishared.queueMacroTask(() => setCurrentImageSize(undefined)); // unset the size accessor next event loop iteration, so that all onCleanup's have time to run, since the effects run more aggressively and can create a size accessor with a cleaned up owner otherwise
183
+ });
184
+
185
+ container.append($gVhhF$solidjsweb.createComponent((0, $19950faaac026e09$export$6e5611bc7e57e477), {
186
+ style: "width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0;",
187
+ get size() {
188
+ return $gVhhF$solidjs.createMemo(() => currentImageSize()?.() || 0);
189
+ },
190
+ get src() {
191
+ return props.src;
192
+ }
193
+ }));
194
+ return container;
195
+ }
66
196
  const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>`, 4);
67
197
  function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
68
198
  return (() => {
@@ -660,15 +790,19 @@ function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
660
790
  const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
661
791
  return (() => {
662
792
  const _el$ = $gVhhF$solidjsweb.getNextElement($72f96c4782db0b1b$var$_tmpl$);
663
- $gVhhF$solidjsweb.insert(_el$, () => $363ce4d1d71041aa$export$d41d19e89346fa2({
664
- product_card_template_: (...args) => props.product_card_template(...args),
665
- recommendations_resource_: recommendations_resource_,
666
- market_: () => props.market,
667
- merchant_: () => props.merchant,
668
- layout_options_: $gVhhF$solidjs.createMemo(() => ({
669
- cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
670
- ...grid_spacing_override()
671
- }))
793
+ $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
794
+ get children() {
795
+ return $363ce4d1d71041aa$export$d41d19e89346fa2({
796
+ product_card_template_: (...args) => props.product_card_template(...args),
797
+ recommendations_resource_: recommendations_resource_,
798
+ market_: () => props.market,
799
+ merchant_: () => props.merchant,
800
+ layout_options_: $gVhhF$solidjs.createMemo(() => ({
801
+ cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
802
+ ...grid_spacing_override()
803
+ }))
804
+ });
805
+ }
672
806
  }));
673
807
  return _el$;
674
808
  })();
@@ -773,83 +907,25 @@ function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
773
907
  const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
774
908
  return (() => {
775
909
  const _el$2 = $gVhhF$solidjsweb.getNextElement($1f8dbf7e28b3eff2$var$_tmpl$2);
776
- $gVhhF$solidjsweb.insert(_el$2, () => $b8e79813f4f7ebe4$export$7da560f849543dff({
777
- rows_object_: rows_object_,
778
- product_card_template_: (...args) => props.product_card_template(...args),
779
- recommendations_resource_: recommendations_resource_,
780
- market_: () => props.market,
781
- merchant_: () => props.merchant,
782
- layout_options_: $gVhhF$solidjs.createMemo(() => ({
783
- cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
784
- ...grid_spacing_override()
785
- }))
910
+ $gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
911
+ get children() {
912
+ return $b8e79813f4f7ebe4$export$7da560f849543dff({
913
+ rows_object_: rows_object_,
914
+ product_card_template_: (...args) => props.product_card_template(...args),
915
+ recommendations_resource_: recommendations_resource_,
916
+ market_: () => props.market,
917
+ merchant_: () => props.merchant,
918
+ layout_options_: $gVhhF$solidjs.createMemo(() => ({
919
+ cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
920
+ ...grid_spacing_override()
921
+ }))
922
+ });
923
+ }
786
924
  }));
787
925
  return _el$2;
788
926
  })();
789
927
  }, "RecommendationGrid failed");
790
928
  }
791
- const $19950faaac026e09$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<img>`, 1);
792
- function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
793
- const [size, setSize] = $gVhhF$solidjs.createSignal(0);
794
- const resizeObserver = new ResizeObserver($gVhhF$depictaiutilishared.catchify(records => {
795
- for (let j = 0; j < records.length; j++) {
796
- const {
797
- width: width
798
- } = records[j].contentRect;
799
- if (!width) continue;
800
- // add extra 5% just in case. + safari is (in some cases) acting a bit questionable and needs a third extra to fill the set width
801
- const new_size = width * 1.05 * ((0, $gVhhF$depictaiutilishared.is_safari) ? 4 / 3 : 1);
802
- setSize(Math.round(new_size));
803
- }
804
- }));
805
- // If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
806
- // It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
807
- const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists(whatToWatch, ({
808
- element: element
809
- }) => requestAnimationFrame($gVhhF$depictaiutilishared.catchify(() => resizeObserver.observe(element))));
810
- $gVhhF$solidjs.onCleanup(() => {
811
- resizeObserver.disconnect();
812
- disconnect();
813
- });
814
- return size;
815
- }
816
- function $19950faaac026e09$export$6e5611bc7e57e477({
817
- src: raw_src,
818
- size: size,
819
- resolutions = [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096],
820
- ...otherOptions
821
- }) {
822
- const src = new URL(raw_src, location.origin);
823
- const fallbackSrc = $19950faaac026e09$var$generateImageUrl(src, 400);
824
- const srcset = $19950faaac026e09$var$make_srcset(src, resolutions);
825
- return (() => {
826
- const _el$ = $gVhhF$solidjsweb.getNextElement($19950faaac026e09$var$_tmpl$);
827
- $gVhhF$solidjsweb.spread(_el$, $gVhhF$solidjsweb.mergeProps(otherOptions, {
828
- "src": fallbackSrc,
829
- "srcset": srcset,
830
- get sizes() {
831
- return size() + "px";
832
- }
833
- }), false, false);
834
- $gVhhF$solidjsweb.runHydrationEvents();
835
- return _el$;
836
- })();
837
- }
838
- function $19950faaac026e09$var$make_srcset(url, resolutions) {
839
- return resolutions.map(width => `${$19950faaac026e09$var$generateImageUrl(url, width)} ${width}w`).join(", ");
840
- }
841
- function $19950faaac026e09$var$generateImageUrl(url, width) {
842
- url.searchParams.set("width", width);
843
- return url.href;
844
- }
845
- const $93304d59a9747aa6$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2);
846
- function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
847
- return (() => {
848
- const _el$ = $gVhhF$solidjsweb.getNextElement($93304d59a9747aa6$var$_tmpl$);
849
- $gVhhF$solidjsweb.effect(_$p => $gVhhF$solidjsweb.style(_el$, `position:relative;width:100%;padding-bottom:${1 / props.aspectRatio * 100}%`, _$p));
850
- return _el$;
851
- })();
852
- }
853
929
  function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
854
930
  const {
855
931
  collapse: collapse,
@@ -6541,26 +6617,30 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6541
6617
  severity_: "error",
6542
6618
  message_: "Showing results failed",
6543
6619
  get children() {
6544
- return $fe76fb463cc60b89$export$3925f87b1545cfc6({
6545
- min_products_to_fetch_:
6546
- // if you want to get if all products have been loaded you can add an optional signal here, see SearchPage
6547
- min_products_to_fetch_,
6548
- query_base_: query_base_,
6549
- plp_results_: plp_results_,
6550
- depict_api_: depict_api_,
6551
- first_result_in_viewport_: first_result_in_viewport_,
6552
- last_result_in_viewport_: last_result_in_viewport_,
6553
- scroll_restoration_data_: scroll_restoration_data_,
6554
- layout_options_: layout_options_,
6555
- product_card_template_: product_card_template_,
6556
- sort_or_filter_open_: sort_or_filter_open_,
6557
- desktop_filter_elements_: desktop_filter_elements_,
6558
- id_currently_querying_for_: query_id_,
6559
- no_results_options_: {
6560
- selected_filters_: selected_filters_,
6561
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6562
- i18n_: i18n_,
6563
- local_filter_cache_: local_filter_cache_
6620
+ return $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
6621
+ get children() {
6622
+ return $fe76fb463cc60b89$export$3925f87b1545cfc6({
6623
+ min_products_to_fetch_:
6624
+ // if you want to get if all products have been loaded you can add an optional signal here, see SearchPage
6625
+ min_products_to_fetch_,
6626
+ query_base_: query_base_,
6627
+ plp_results_: plp_results_,
6628
+ depict_api_: depict_api_,
6629
+ first_result_in_viewport_: first_result_in_viewport_,
6630
+ last_result_in_viewport_: last_result_in_viewport_,
6631
+ scroll_restoration_data_: scroll_restoration_data_,
6632
+ layout_options_: layout_options_,
6633
+ product_card_template_: product_card_template_,
6634
+ sort_or_filter_open_: sort_or_filter_open_,
6635
+ desktop_filter_elements_: desktop_filter_elements_,
6636
+ id_currently_querying_for_: query_id_,
6637
+ no_results_options_: {
6638
+ selected_filters_: selected_filters_,
6639
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6640
+ i18n_: i18n_,
6641
+ local_filter_cache_: local_filter_cache_
6642
+ }
6643
+ });
6564
6644
  }
6565
6645
  });
6566
6646
  }
@@ -7562,8 +7642,10 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
7562
7642
  }) {
7563
7643
  const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
7564
7644
  const rows_object = view_more_button_ ? $fb29c6201c369e39$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
7565
- const [recommendations_resource] = $gVhhF$solidjs.createResource(search_query_base_, query => depict_api_.get_recommended(query).then(r => r.displays));
7566
- const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource.loading || recommendations_resource()?.length);
7645
+ const [recommendations_resource] = $gVhhF$solidjs.createResource(() => all_products_loaded_() && search_query_base_(),
7646
+ // only fetch/refetch if all products are loaded
7647
+ query => query && depict_api_.get_recommended(query).then(r => r.displays));
7648
+ const should_show = $gVhhF$solidjs.createMemo(() => !!((recommendations_resource.loading || recommendations_resource()?.length) && all_products_loaded_()));
7567
7649
  const num_placeholders_ = $gVhhF$solidjs.createMemo(() => (0, $aec24316ed262dc0$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_().cols_at_size.map(([per_column]) => per_column)));
7568
7650
  // Don't tear down elements every time one updates the page - don't put them within <Show>
7569
7651
  const elements = (() => {
@@ -7593,7 +7675,10 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
7593
7675
  get children() {
7594
7676
  return (() => {
7595
7677
  // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
7596
- const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource() || []));
7678
+ const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(prev => {
7679
+ if (!should_show() && prev) return prev; // When we're invisible, don't update what we're rendering to be possibly undefined to preserve the same products if possible
7680
+ return recommendations_resource() || [];
7681
+ }));
7597
7682
  return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
7598
7683
  displays_by_key_: displays_by_key_,
7599
7684
  merchant_: $gVhhF$solidjs.createMemo(() => search_query_base_().tenant),
@@ -7609,7 +7694,7 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
7609
7694
  })();
7610
7695
  return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
7611
7696
  get when() {
7612
- return $gVhhF$solidjsweb.memo(() => !!is_showing_something())() && all_products_loaded_();
7697
+ return should_show();
7613
7698
  },
7614
7699
  children: elements
7615
7700
  });
@@ -9067,17 +9152,21 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
9067
9152
  severity_: "error",
9068
9153
  message_: "Instant results failed",
9069
9154
  get children() {
9070
- return $6ae556e536054e87$export$62f101a8aa597bf8({
9071
- search_field_value_: search_field_value_,
9072
- depict_api_: depict_api_,
9073
- tenant_: tenant_,
9074
- i18n_: i18n_,
9075
- market_: market_,
9076
- set_total_num_results_accessor_: set_total_num_results_accessor_,
9077
- router_: router_,
9078
- set_modal_search_results_: set_modal_search_results_,
9079
- content_search_enabled_: content_search_enabled_,
9080
- ...instant_results_options_
9155
+ return $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
9156
+ get children() {
9157
+ return $6ae556e536054e87$export$62f101a8aa597bf8({
9158
+ search_field_value_: search_field_value_,
9159
+ depict_api_: depict_api_,
9160
+ tenant_: tenant_,
9161
+ i18n_: i18n_,
9162
+ market_: market_,
9163
+ set_total_num_results_accessor_: set_total_num_results_accessor_,
9164
+ router_: router_,
9165
+ set_modal_search_results_: set_modal_search_results_,
9166
+ content_search_enabled_: content_search_enabled_,
9167
+ ...instant_results_options_
9168
+ });
9169
+ }
9081
9170
  });
9082
9171
  }
9083
9172
  }), _el$10, _co$2);
@@ -9978,14 +10067,18 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
9978
10067
  return content_search_enabled_();
9979
10068
  },
9980
10069
  get children() {
9981
- return $gVhhF$solidjsweb.createComponent((0, $3716b8caf7f959e2$export$6d0c9c22f6652669), {
9982
- content_results_rows_: content_results_rows_,
9983
- search_results_: search_results_,
9984
- i18n_: i18n_,
9985
- get_search_query_: get_search_query_,
9986
- layout_options_: content_layout_options_,
9987
- router_: router_,
9988
- query_base_: search_query_base_
10070
+ return $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
10071
+ get children() {
10072
+ return $gVhhF$solidjsweb.createComponent((0, $3716b8caf7f959e2$export$6d0c9c22f6652669), {
10073
+ content_results_rows_: content_results_rows_,
10074
+ search_results_: search_results_,
10075
+ i18n_: i18n_,
10076
+ get_search_query_: get_search_query_,
10077
+ layout_options_: content_layout_options_,
10078
+ router_: router_,
10079
+ query_base_: search_query_base_
10080
+ });
10081
+ }
9989
10082
  });
9990
10083
  }
9991
10084
  });
@@ -10019,28 +10112,32 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
10019
10112
  severity_: "error",
10020
10113
  message_: "Search results failed",
10021
10114
  get children() {
10022
- return $fe76fb463cc60b89$export$3925f87b1545cfc6({
10023
- all_products_loaded_: all_products_loaded_,
10024
- min_products_to_fetch_: min_products_to_fetch_,
10025
- query_base_: search_query_base_,
10026
- plp_results_: search_results_,
10027
- depict_api_: depict_api_,
10028
- first_result_in_viewport_: first_result_in_viewport_,
10029
- last_result_in_viewport_: last_result_in_viewport_,
10030
- scroll_restoration_data_: scroll_restoration_data_,
10031
- desktop_filter_elements_: desktop_filter_elements_,
10032
- product_card_template_: product_card_template_,
10033
- layout_options_: layout_options_,
10034
- sort_or_filter_open_: sort_or_filter_open_,
10035
- id_currently_querying_for_: get_search_query_,
10036
- no_results_options_: {
10037
- selected_filters_: selected_filters_,
10038
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
10039
- local_filter_cache_: local_filter_cache_,
10040
- i18n_: {
10041
- ...i18n_,
10042
- no_results_text_: no_results_text_
10043
- }
10115
+ return $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
10116
+ get children() {
10117
+ return $fe76fb463cc60b89$export$3925f87b1545cfc6({
10118
+ all_products_loaded_: all_products_loaded_,
10119
+ min_products_to_fetch_: min_products_to_fetch_,
10120
+ query_base_: search_query_base_,
10121
+ plp_results_: search_results_,
10122
+ depict_api_: depict_api_,
10123
+ first_result_in_viewport_: first_result_in_viewport_,
10124
+ last_result_in_viewport_: last_result_in_viewport_,
10125
+ scroll_restoration_data_: scroll_restoration_data_,
10126
+ desktop_filter_elements_: desktop_filter_elements_,
10127
+ product_card_template_: product_card_template_,
10128
+ layout_options_: layout_options_,
10129
+ sort_or_filter_open_: sort_or_filter_open_,
10130
+ id_currently_querying_for_: get_search_query_,
10131
+ no_results_options_: {
10132
+ selected_filters_: selected_filters_,
10133
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
10134
+ local_filter_cache_: local_filter_cache_,
10135
+ i18n_: {
10136
+ ...i18n_,
10137
+ no_results_text_: no_results_text_
10138
+ }
10139
+ }
10140
+ });
10044
10141
  }
10045
10142
  });
10046
10143
  }
@@ -10053,17 +10150,21 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
10053
10150
  severity_: "error",
10054
10151
  message_: "Search recommendations failed",
10055
10152
  get children() {
10056
- return $gVhhF$solidjsweb.createComponent((0, $fb29c6201c369e39$export$7de92c4c2205ebf3), {
10057
- depict_api_: depict_api_,
10058
- i18n_: i18n_,
10059
- search_query_base_: search_query_base_,
10060
- get layout_options_() {
10061
- return $gVhhF$solidjs.createMemo(() => recommendations_layout_options_?.() ?? layout_options_());
10062
- },
10063
- showing_recommendation_rows_: showing_recommendation_rows_,
10064
- view_more_button_: search_recs_view_more_,
10065
- product_card_template_: product_card_template_,
10066
- all_products_loaded_: get_all_products_loaded
10153
+ return $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
10154
+ get children() {
10155
+ return $gVhhF$solidjsweb.createComponent((0, $fb29c6201c369e39$export$7de92c4c2205ebf3), {
10156
+ depict_api_: depict_api_,
10157
+ i18n_: i18n_,
10158
+ search_query_base_: search_query_base_,
10159
+ get layout_options_() {
10160
+ return $gVhhF$solidjs.createMemo(() => recommendations_layout_options_?.() ?? layout_options_());
10161
+ },
10162
+ showing_recommendation_rows_: showing_recommendation_rows_,
10163
+ view_more_button_: search_recs_view_more_,
10164
+ product_card_template_: product_card_template_,
10165
+ all_products_loaded_: get_all_products_loaded
10166
+ });
10167
+ }
10067
10168
  });
10068
10169
  }
10069
10170
  });
package/latest/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { JSX, Signal, Accessor, Setter } from "solid-js";
1
+ import { JSX, Accessor, Signal, Setter } from "solid-js";
2
2
  import { Amazing_Slider, Display, ColsAtSize, report, Elem, ModernDisplay, Node_Array } from "@depict-ai/utilishared/latest";
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";
@@ -7,7 +7,55 @@ 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.14";
10
+ export const version = "2.0.15";
11
+ /**
12
+ * Provider to wrap every listing (group of products) in
13
+ * Used for example for deduplicating ResizeObservers for responsive images
14
+ */
15
+ export function ListingProvider(props: {
16
+ children: JSX.Element;
17
+ }): JSX.Element;
18
+ /**
19
+ * Use this to get the context object if your component is within a ListingProvider
20
+ */
21
+ export function useListing(): Record<symbol, any> | undefined;
22
+ /** @jsxImportSource solid-js */
23
+ /**
24
+ * ImageContainer for using the padding hack to set the aspect ratio of an image
25
+ * 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)
26
+ * (Not using the CSS aspect-ratio property yet here due to browser support)
27
+ */
28
+ export function ImageContainer(props: {
29
+ aspectRatio: number;
30
+ }): HTMLDivElement;
31
+ /**
32
+ * Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
33
+ */
34
+ export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
35
+ /**
36
+ * Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
37
+ * This is used for our responsive images:
38
+ * 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.
39
+ * 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
40
+ * 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.
41
+ */
42
+ export function ShopifyResponsiveImg(props: {
43
+ resolutions?: number[];
44
+ size: Accessor<number>;
45
+ } & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes"> & {
46
+ src: string;
47
+ }): HTMLImageElement;
48
+ export const shopifyContainedImageContextSymbol: unique symbol;
49
+ /**
50
+ * Abstraction built on top of ShopifyResponsiveImg
51
+ * @param src TODO
52
+ * @param aspectRatio
53
+ * @constructor
54
+ */
55
+ export function ShopifyContainedImage(props: {
56
+ src: string;
57
+ aspectRatio: number;
58
+ }): HTMLDivElement;
11
59
  /** @jsxImportSource solid-js */
12
60
  export function GenericSliderArrowButton(props?: {
13
61
  width_?: number;
@@ -154,37 +202,6 @@ export function RecommendationGrid<T extends Display>(props: {
154
202
  merchant?: never;
155
203
  market?: never;
156
204
  } & RecommendationGridBaseProps<T>): HTMLDivElement;
157
- /**
158
- * Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
159
- */
160
- export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
161
- /**
162
- * Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
163
- * This is used for our responsive images:
164
- * 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.
165
- * 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
166
- * 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.
167
- */
168
- export function ShopifyResponsiveImg({
169
- src: raw_src,
170
- size,
171
- resolutions,
172
- ...otherOptions
173
- }: {
174
- resolutions?: number[];
175
- size: Accessor<number>;
176
- } & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes"> & {
177
- src: string;
178
- }): HTMLImageElement;
179
- /** @jsxImportSource solid-js */
180
- /**
181
- * ImageContainer for using the padding hack to set the aspect ratio of an image
182
- * 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)
183
- * (Not using the CSS aspect-ratio property yet here due to browser support)
184
- */
185
- export function ImageContainer(props: {
186
- aspectRatio: number;
187
- }): HTMLDivElement;
188
205
  export function ExpandingDetails(props: {
189
206
  details_: HTMLDetailsElement;
190
207
  summary_: HTMLElement;