@depict-ai/ui 0.0.19 → 0.0.21

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/dist/index.d.ts CHANGED
@@ -34,7 +34,7 @@ export const embedded_num_products: ({ make_product_count_, set_observed_results
34
34
  middle_elements_: Accessor<JSX.Element>;
35
35
  on_filters_constructed_: () => void;
36
36
  };
37
- export const version = "0.0.19";
37
+ export const version = "0.0.21";
38
38
  export function add_to_version_info(stuff_to_add: {
39
39
  [key: string]: string;
40
40
  }): void;
package/dist/main.js CHANGED
@@ -168,7 +168,7 @@ const $93e94e7b0aa8ca88$export$824dde41348efed1 = /*@__PURE__*/ (()=>{
168
168
 
169
169
 
170
170
 
171
- const $b757f75811f3261f$export$83d89fbfd8236492 = "0.0.19";
171
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "0.0.21";
172
172
 
173
173
 
174
174
  /**
@@ -1750,6 +1750,7 @@ function $d659702496cb72ea$export$469c7af753d08925({ price_: price_ , price_form
1750
1750
 
1751
1751
 
1752
1752
 
1753
+
1753
1754
  class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
1754
1755
  #stop_listening;
1755
1756
  #disconnect_observer;
@@ -1776,7 +1777,12 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
1776
1777
  }
1777
1778
  });
1778
1779
  #get_rendered_recs() {
1779
- return (0, $iBTHO$depictaiutilishared.catchify)(this.render_, "rendering failed")(true) || [];
1780
+ return (0, $iBTHO$solidjs.createRoot)((dispose)=>{
1781
+ this.addEventListener("close", dispose, {
1782
+ once: true
1783
+ });
1784
+ return (0, $iBTHO$depictaiutilishared.catchify)(this.render_, "rendering failed")(true) || [];
1785
+ });
1780
1786
  }
1781
1787
  #unload = (0, $iBTHO$depictaiutilishared.catchify)(()=>{
1782
1788
  if (!this.#is_open) return;
@@ -3081,38 +3087,53 @@ async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_
3081
3087
 
3082
3088
 
3083
3089
 
3084
-
3085
3090
 
3086
3091
 
3087
3092
  const $b3cf6ca8dc0e9998$var$_tmpl$ = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<span class="count"></span>`, 2), $b3cf6ca8dc0e9998$var$_tmpl$2 = /*#__PURE__*/ (0, $iBTHO$solidjsweb.template)(`<label class="input-row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text"></span></div></label>`, 9);
3088
3093
  const $b3cf6ca8dc0e9998$export$48513f6b9f8ce62d = (props)=>{
3094
+ // It seems like there's no diffing without memos here (since we often just have computations in the getters above that update to the same result often because their dependencies change with unrelated changes often), so put memos here to avoid unneeded DOM changes
3095
+ const count = (0, $iBTHO$solidjs.createMemo)(()=>props.count_);
3096
+ const label = (0, $iBTHO$solidjs.createMemo)(()=>props.label_);
3097
+ const checked = (0, $iBTHO$solidjs.createMemo)(()=>props.checked_);
3098
+ const value = (0, $iBTHO$solidjs.createMemo)(()=>props.value_);
3099
+ const is_count_zero = (0, $iBTHO$solidjs.createMemo)(()=>props.is_count_zero_);
3089
3100
  const id = (0, $iBTHO$depictaiutilishared.make_random_classname)();
3090
3101
  return /* We can't use actual margin because ExpandingContainer gets messed up */ (()=>{
3091
3102
  const _el$ = $b3cf6ca8dc0e9998$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$4.nextSibling;
3092
3103
  (0, $iBTHO$solidjsweb.setAttribute)(_el$, "for", id);
3104
+ (0, $iBTHO$solidjsweb.use)((input_el)=>{
3105
+ // For the checkboxes we know that they changed by putting them into a form and listening on the form changing.
3106
+ // A bug here was that some checkboxes didn't match the state of their checked() solid accessor.
3107
+ // The reason for that being that we re-use the checkboxes. That means if one box was unchecked by the user and then removed, the "checked" value of "another" checkbox (that now had position 0) had changed to 0 (because the user unchecked the box with position 0) while solid js still believed that it was checked because it's checked signal hadn't changed.
3108
+ // I've worked around this by restoring the state of the checkbox to what it is in solid js a bit after it was changed
3109
+ // Why it can't be done instantaneously I don't know.
3110
+ input_el.addEventListener("change", (0, $iBTHO$depictaiutilishared.catchify)(()=>requestAnimationFrame((0, $iBTHO$depictaiutilishared.catchify)(()=>{
3111
+ if (input_el.checked !== checked()) input_el.checked = checked();
3112
+ }))));
3113
+ props.input_ref_?.(input_el);
3114
+ }, _el$3);
3093
3115
  (0, $iBTHO$solidjsweb.setAttribute)(_el$3, "id", id);
3094
- (0, $iBTHO$solidjsweb.spread)(_el$3, (0, $iBTHO$solidjsweb.mergeProps)({
3095
- get name () {
3096
- return props.value_;
3097
- },
3098
- get checked () {
3099
- return props.checked_;
3100
- }
3101
- }, ()=>props.input_ref_ ? {
3102
- ref: props.input_ref_
3103
- } : {}), false, false);
3104
- (0, $iBTHO$solidjsweb.insert)(_el$5, ()=>props.label_ /* don't destructure this it could be a reactive getter */ || props.value_);
3116
+ (0, $iBTHO$solidjsweb.insert)(_el$5, ()=>label() || value());
3105
3117
  (0, $iBTHO$solidjsweb.insert)(_el$, (0, $iBTHO$solidjsweb.createComponent)((0, $iBTHO$solidjs.Show), {
3106
3118
  get when () {
3107
- return props.count_ != undefined;
3119
+ return count() != undefined;
3108
3120
  },
3109
3121
  get children () {
3110
3122
  const _el$6 = $b3cf6ca8dc0e9998$var$_tmpl$.cloneNode(true);
3111
- (0, $iBTHO$solidjsweb.insert)(_el$6, ()=>props.count_);
3123
+ (0, $iBTHO$solidjsweb.insert)(_el$6, count);
3112
3124
  return _el$6;
3113
3125
  }
3114
3126
  }), null);
3115
- (0, $iBTHO$solidjsweb.effect)(()=>_el$.classList.toggle("count-0", !!(props.is_count_zero_ || props.count_ === 0)));
3127
+ (0, $iBTHO$solidjsweb.effect)((_p$)=>{
3128
+ const _v$ = !!(is_count_zero() || count() === 0), _v$2 = value();
3129
+ _v$ !== _p$._v$ && _el$.classList.toggle("count-0", _p$._v$ = _v$);
3130
+ _v$2 !== _p$._v$2 && (0, $iBTHO$solidjsweb.setAttribute)(_el$3, "name", _p$._v$2 = _v$2);
3131
+ return _p$;
3132
+ }, {
3133
+ _v$: undefined,
3134
+ _v$2: undefined
3135
+ });
3136
+ (0, $iBTHO$solidjsweb.effect)(()=>_el$3.checked = checked());
3116
3137
  return _el$;
3117
3138
  })();
3118
3139
  };
@@ -3164,7 +3185,7 @@ function $d94869c80e337a3d$export$dd948f91abc3a1c4({ filter_: filter_ , selected
3164
3185
  }));
3165
3186
  });
3166
3187
  const render_checkbox = (checkbox)=>{
3167
- // Checkbox always calls the getters in props so we don't wrap these values into memos
3188
+ // Checkbox always calls the getters in props, so we don't wrap these values into memos
3168
3189
  return (0, $iBTHO$solidjsweb.createComponent)((0, $b3cf6ca8dc0e9998$export$48513f6b9f8ce62d), {
3169
3190
  get value_ () {
3170
3191
  return checkbox().value_;
@@ -7734,6 +7755,7 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({ search_field_value_: search
7734
7755
  const body_style = (0, $iBTHO$solidjs.createMemo)(()=>{
7735
7756
  const style_obj = {
7736
7757
  width: "80vw",
7758
+ position: "absolute",
7737
7759
  ...style_props_[0]()
7738
7760
  };
7739
7761
  return {
package/dist/module.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {dlog as $kyEB6$dlog, Placeholder as $kyEB6$Placeholder, catchify as $kyEB6$catchify, base_url as $kyEB6$base_url, get_depict_id as $kyEB6$get_depict_id, get_user_id as $kyEB6$get_user_id, get_session_id as $kyEB6$get_session_id, make_url_with_query_params as $kyEB6$make_url_with_query_params, fetch_retry as $kyEB6$fetch_retry, sort_obj as $kyEB6$sort_obj, version as $kyEB6$version, observer as $kyEB6$observer, report as $kyEB6$report, ContainedPlaceholderImage as $kyEB6$ContainedPlaceholderImage, javascript_media_query as $kyEB6$javascript_media_query, href_change_ipns as $kyEB6$href_change_ipns, standard_price_format as $kyEB6$standard_price_format, deparallelize as $kyEB6$deparallelize, make_asyncIterable_exiter as $kyEB6$make_asyncIterable_exiter, insert_surfaces as $kyEB6$insert_surfaces, Tenant as $kyEB6$Tenant, deparallelize_no_drop as $kyEB6$deparallelize_no_drop, default_rr as $kyEB6$default_rr, make_random_classname as $kyEB6$make_random_classname, n_col_styling_with_dist as $kyEB6$n_col_styling_with_dist, Lazyfier as $kyEB6$Lazyfier, queueMacroTask as $kyEB6$queueMacroTask, Rec_Renderer as $kyEB6$Rec_Renderer, CrossIcon as $kyEB6$CrossIcon, useExpandingContainer as $kyEB6$useExpandingContainer, Amazing_Slider as $kyEB6$Amazing_Slider, slider_snap_css as $kyEB6$slider_snap_css, slider_fading_factory as $kyEB6$slider_fading_factory, MinusIcon as $kyEB6$MinusIcon, FilterIcon as $kyEB6$FilterIcon, SortIconAsc as $kyEB6$SortIconAsc, SortIconDesc as $kyEB6$SortIconDesc, PlusIcon as $kyEB6$PlusIcon, TickIcon as $kyEB6$TickIcon, ArrowUp as $kyEB6$ArrowUp, normal_get_product_id as $kyEB6$normal_get_product_id, GenericSliderArrowButton as $kyEB6$GenericSliderArrowButton, BackIcon as $kyEB6$BackIcon, SearchIcon as $kyEB6$SearchIcon, Layout as $kyEB6$Layout, make_placeholder_rr as $kyEB6$make_placeholder_rr, async_iterable_ipns as $kyEB6$async_iterable_ipns, depict_click as $kyEB6$depict_click, impression_track_element as $kyEB6$impression_track_element, add_new_tab_listener as $kyEB6$add_new_tab_listener, ContainedImage as $kyEB6$ContainedImage, buildThresholdList as $kyEB6$buildThresholdList, PreviousSearchIcon as $kyEB6$PreviousSearchIcon} from "@depict-ai/utilishared";
2
2
  import {template as $kyEB6$template, insert as $kyEB6$insert, createComponent as $kyEB6$createComponent, spread as $kyEB6$spread, effect as $kyEB6$effect, setAttribute as $kyEB6$setAttribute, use as $kyEB6$use, addEventListener as $kyEB6$addEventListener, delegateEvents as $kyEB6$delegateEvents, memo as $kyEB6$memo, style as $kyEB6$style, mergeProps as $kyEB6$mergeProps, classList as $kyEB6$classList, className as $kyEB6$className} from "solid-js/web";
3
- import {createSignal as $kyEB6$createSignal, untrack as $kyEB6$untrack, createMemo as $kyEB6$createMemo, onCleanup as $kyEB6$onCleanup, createEffect as $kyEB6$createEffect, createComputed as $kyEB6$createComputed, batch as $kyEB6$batch, createRoot as $kyEB6$createRoot, createResource as $kyEB6$createResource, Show as $kyEB6$Show, createRenderEffect as $kyEB6$createRenderEffect, runWithOwner as $kyEB6$runWithOwner, getOwner as $kyEB6$getOwner, on as $kyEB6$on, Index as $kyEB6$Index, For as $kyEB6$For, ErrorBoundary as $kyEB6$ErrorBoundary} from "solid-js";
3
+ import {createSignal as $kyEB6$createSignal, untrack as $kyEB6$untrack, createMemo as $kyEB6$createMemo, onCleanup as $kyEB6$onCleanup, createEffect as $kyEB6$createEffect, createRoot as $kyEB6$createRoot, createComputed as $kyEB6$createComputed, batch as $kyEB6$batch, createResource as $kyEB6$createResource, Show as $kyEB6$Show, createRenderEffect as $kyEB6$createRenderEffect, runWithOwner as $kyEB6$runWithOwner, getOwner as $kyEB6$getOwner, on as $kyEB6$on, Index as $kyEB6$Index, For as $kyEB6$For, ErrorBoundary as $kyEB6$ErrorBoundary} from "solid-js";
4
4
 
5
5
  /*! Depict.ai search and product listing SDK */
6
6
 
@@ -117,7 +117,7 @@ const $a79d86d64fb64e8e$export$824dde41348efed1 = /*@__PURE__*/ (()=>{
117
117
 
118
118
 
119
119
 
120
- const $ec291e0010116877$export$83d89fbfd8236492 = "0.0.19";
120
+ const $ec291e0010116877$export$83d89fbfd8236492 = "0.0.21";
121
121
 
122
122
 
123
123
  /**
@@ -1699,6 +1699,7 @@ function $8c0f86cb3e266eeb$export$469c7af753d08925({ price_: price_ , price_form
1699
1699
 
1700
1700
 
1701
1701
 
1702
+
1702
1703
  class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
1703
1704
  #stop_listening;
1704
1705
  #disconnect_observer;
@@ -1725,7 +1726,12 @@ class $753e9b2889a47c89$export$3ccaa27d81dd8556 extends EventTarget {
1725
1726
  }
1726
1727
  });
1727
1728
  #get_rendered_recs() {
1728
- return (0, $kyEB6$catchify)(this.render_, "rendering failed")(true) || [];
1729
+ return (0, $kyEB6$createRoot)((dispose)=>{
1730
+ this.addEventListener("close", dispose, {
1731
+ once: true
1732
+ });
1733
+ return (0, $kyEB6$catchify)(this.render_, "rendering failed")(true) || [];
1734
+ });
1729
1735
  }
1730
1736
  #unload = (0, $kyEB6$catchify)(()=>{
1731
1737
  if (!this.#is_open) return;
@@ -3030,38 +3036,53 @@ async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_
3030
3036
 
3031
3037
 
3032
3038
 
3033
-
3034
3039
 
3035
3040
 
3036
3041
  const $87c712b5b33f24f7$var$_tmpl$ = /*#__PURE__*/ (0, $kyEB6$template)(`<span class="count"></span>`, 2), $87c712b5b33f24f7$var$_tmpl$2 = /*#__PURE__*/ (0, $kyEB6$template)(`<label class="input-row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text"></span></div></label>`, 9);
3037
3042
  const $87c712b5b33f24f7$export$48513f6b9f8ce62d = (props)=>{
3043
+ // It seems like there's no diffing without memos here (since we often just have computations in the getters above that update to the same result often because their dependencies change with unrelated changes often), so put memos here to avoid unneeded DOM changes
3044
+ const count = (0, $kyEB6$createMemo)(()=>props.count_);
3045
+ const label = (0, $kyEB6$createMemo)(()=>props.label_);
3046
+ const checked = (0, $kyEB6$createMemo)(()=>props.checked_);
3047
+ const value = (0, $kyEB6$createMemo)(()=>props.value_);
3048
+ const is_count_zero = (0, $kyEB6$createMemo)(()=>props.is_count_zero_);
3038
3049
  const id = (0, $kyEB6$make_random_classname)();
3039
3050
  return /* We can't use actual margin because ExpandingContainer gets messed up */ (()=>{
3040
3051
  const _el$ = $87c712b5b33f24f7$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$5 = _el$4.nextSibling;
3041
3052
  (0, $kyEB6$setAttribute)(_el$, "for", id);
3053
+ (0, $kyEB6$use)((input_el)=>{
3054
+ // For the checkboxes we know that they changed by putting them into a form and listening on the form changing.
3055
+ // A bug here was that some checkboxes didn't match the state of their checked() solid accessor.
3056
+ // The reason for that being that we re-use the checkboxes. That means if one box was unchecked by the user and then removed, the "checked" value of "another" checkbox (that now had position 0) had changed to 0 (because the user unchecked the box with position 0) while solid js still believed that it was checked because it's checked signal hadn't changed.
3057
+ // I've worked around this by restoring the state of the checkbox to what it is in solid js a bit after it was changed
3058
+ // Why it can't be done instantaneously I don't know.
3059
+ input_el.addEventListener("change", (0, $kyEB6$catchify)(()=>requestAnimationFrame((0, $kyEB6$catchify)(()=>{
3060
+ if (input_el.checked !== checked()) input_el.checked = checked();
3061
+ }))));
3062
+ props.input_ref_?.(input_el);
3063
+ }, _el$3);
3042
3064
  (0, $kyEB6$setAttribute)(_el$3, "id", id);
3043
- (0, $kyEB6$spread)(_el$3, (0, $kyEB6$mergeProps)({
3044
- get name () {
3045
- return props.value_;
3046
- },
3047
- get checked () {
3048
- return props.checked_;
3049
- }
3050
- }, ()=>props.input_ref_ ? {
3051
- ref: props.input_ref_
3052
- } : {}), false, false);
3053
- (0, $kyEB6$insert)(_el$5, ()=>props.label_ /* don't destructure this it could be a reactive getter */ || props.value_);
3065
+ (0, $kyEB6$insert)(_el$5, ()=>label() || value());
3054
3066
  (0, $kyEB6$insert)(_el$, (0, $kyEB6$createComponent)((0, $kyEB6$Show), {
3055
3067
  get when () {
3056
- return props.count_ != undefined;
3068
+ return count() != undefined;
3057
3069
  },
3058
3070
  get children () {
3059
3071
  const _el$6 = $87c712b5b33f24f7$var$_tmpl$.cloneNode(true);
3060
- (0, $kyEB6$insert)(_el$6, ()=>props.count_);
3072
+ (0, $kyEB6$insert)(_el$6, count);
3061
3073
  return _el$6;
3062
3074
  }
3063
3075
  }), null);
3064
- (0, $kyEB6$effect)(()=>_el$.classList.toggle("count-0", !!(props.is_count_zero_ || props.count_ === 0)));
3076
+ (0, $kyEB6$effect)((_p$)=>{
3077
+ const _v$ = !!(is_count_zero() || count() === 0), _v$2 = value();
3078
+ _v$ !== _p$._v$ && _el$.classList.toggle("count-0", _p$._v$ = _v$);
3079
+ _v$2 !== _p$._v$2 && (0, $kyEB6$setAttribute)(_el$3, "name", _p$._v$2 = _v$2);
3080
+ return _p$;
3081
+ }, {
3082
+ _v$: undefined,
3083
+ _v$2: undefined
3084
+ });
3085
+ (0, $kyEB6$effect)(()=>_el$3.checked = checked());
3065
3086
  return _el$;
3066
3087
  })();
3067
3088
  };
@@ -3113,7 +3134,7 @@ function $a4601e6bea3ed1e6$export$dd948f91abc3a1c4({ filter_: filter_ , selected
3113
3134
  }));
3114
3135
  });
3115
3136
  const render_checkbox = (checkbox)=>{
3116
- // Checkbox always calls the getters in props so we don't wrap these values into memos
3137
+ // Checkbox always calls the getters in props, so we don't wrap these values into memos
3117
3138
  return (0, $kyEB6$createComponent)((0, $87c712b5b33f24f7$export$48513f6b9f8ce62d), {
3118
3139
  get value_ () {
3119
3140
  return checkbox().value_;
@@ -7683,6 +7704,7 @@ function $fabfda1230351b1a$export$1c593cbd6f1e10bc({ search_field_value_: search
7683
7704
  const body_style = (0, $kyEB6$createMemo)(()=>{
7684
7705
  const style_obj = {
7685
7706
  width: "80vw",
7707
+ position: "absolute",
7686
7708
  ...style_props_[0]()
7687
7709
  };
7688
7710
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",
@@ -36,7 +36,7 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@depict-ai/utilishared": "^0.0.17",
39
+ "@depict-ai/utilishared": "^0.0.19",
40
40
  "solid-js": "^1.6.2"
41
41
  },
42
42
  "devDependencies": {