@depict-ai/ui 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/main.js +136 -109
- package/dist/client/module.js +137 -111
- package/dist/index.d.ts +78 -27
- package/dist/main.js +169 -126
- package/dist/module.js +259 -131
- package/dist/server/main.js +136 -109
- package/dist/server/module.js +137 -111
- package/package.json +50 -27
package/dist/server/module.js
CHANGED
|
@@ -1,13 +1,63 @@
|
|
|
1
|
-
import {add_to_version_info as $cV3wj$add_to_version_info,
|
|
1
|
+
import {add_to_version_info as $cV3wj$add_to_version_info, observer as $cV3wj$observer, catchify as $cV3wj$catchify, fetch_recs as $cV3wj$fetch_recs, snakeCasifyObject as $cV3wj$snakeCasifyObject, instant_exec_on_suspect_history_change as $cV3wj$instant_exec_on_suspect_history_change, base_url as $cV3wj$base_url, dlog as $cV3wj$dlog, get_depict_id as $cV3wj$get_depict_id, get_user_id as $cV3wj$get_user_id, get_session_id as $cV3wj$get_session_id, make_url_with_query_params as $cV3wj$make_url_with_query_params, fetch_retry as $cV3wj$fetch_retry, add_version_query_params as $cV3wj$add_version_query_params, sort_obj as $cV3wj$sort_obj, report as $cV3wj$report, javascript_media_query as $cV3wj$javascript_media_query, standard_price_format as $cV3wj$standard_price_format, make_random_classname as $cV3wj$make_random_classname, n_col_styling_with_dist as $cV3wj$n_col_styling_with_dist, useExpandingContainer as $cV3wj$useExpandingContainer, Amazing_Slider as $cV3wj$Amazing_Slider, slider_snap_css as $cV3wj$slider_snap_css, slider_fading_factory as $cV3wj$slider_fading_factory, hsl_to_rgb as $cV3wj$hsl_to_rgb, relative_luminance_from_rgb as $cV3wj$relative_luminance_from_rgb, base64_encode_unicode as $cV3wj$base64_encode_unicode, base64_decode_unicode as $cV3wj$base64_decode_unicode, queueMacroTask as $cV3wj$queueMacroTask, dwarn as $cV3wj$dwarn, Layout as $cV3wj$Layout, async_iterable_ipns as $cV3wj$async_iterable_ipns, make_asyncIterable_exiter as $cV3wj$make_asyncIterable_exiter, href_change_ipns as $cV3wj$href_change_ipns, ContainedImage as $cV3wj$ContainedImage, deparallelize_no_drop as $cV3wj$deparallelize_no_drop, insert_surfaces as $cV3wj$insert_surfaces} from "@depict-ai/utilishared";
|
|
2
|
+
import {createRoot as $cV3wj$createRoot, createSignal as $cV3wj$createSignal, getOwner as $cV3wj$getOwner, runWithOwner as $cV3wj$runWithOwner, onCleanup as $cV3wj$onCleanup, createComputed as $cV3wj$createComputed, createRenderEffect as $cV3wj$createRenderEffect, createEffect as $cV3wj$createEffect, untrack as $cV3wj$untrack, batch as $cV3wj$batch, createResource as $cV3wj$createResource, createMemo as $cV3wj$createMemo, Show as $cV3wj$Show, createReaction as $cV3wj$createReaction, Suspense as $cV3wj$Suspense, on as $cV3wj$on, ErrorBoundary as $cV3wj$ErrorBoundary, For as $cV3wj$For, Index as $cV3wj$Index} from "solid-js";
|
|
2
3
|
import {ssrElement as $cV3wj$ssrElement, ssr as $cV3wj$ssr, ssrHydrationKey as $cV3wj$ssrHydrationKey, ssrAttribute as $cV3wj$ssrAttribute, escape as $cV3wj$escape, isServer as $cV3wj$isServer, createComponent as $cV3wj$createComponent, ssrClassList as $cV3wj$ssrClassList, insert as $cV3wj$insert, ssrStyle as $cV3wj$ssrStyle, Dynamic as $cV3wj$Dynamic, mergeProps as $cV3wj$mergeProps} from "solid-js/web";
|
|
3
|
-
import {createSignal as $cV3wj$createSignal, getOwner as $cV3wj$getOwner, createRoot as $cV3wj$createRoot, runWithOwner as $cV3wj$runWithOwner, onCleanup as $cV3wj$onCleanup, createComputed as $cV3wj$createComputed, createRenderEffect as $cV3wj$createRenderEffect, createEffect as $cV3wj$createEffect, untrack as $cV3wj$untrack, batch as $cV3wj$batch, createResource as $cV3wj$createResource, createMemo as $cV3wj$createMemo, Show as $cV3wj$Show, createReaction as $cV3wj$createReaction, Suspense as $cV3wj$Suspense, on as $cV3wj$on, ErrorBoundary as $cV3wj$ErrorBoundary, For as $cV3wj$For, Index as $cV3wj$Index} from "solid-js";
|
|
4
4
|
|
|
5
|
-
/*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.
|
|
5
|
+
/*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.1.2";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_opts) {
|
|
12
|
+
const body = await (0, $cV3wj$observer).wait_for_element("body");
|
|
13
|
+
let dispose_and_remove;
|
|
14
|
+
const open_modal_ = (extra_options_for_modal = {}, on_dispose)=>{
|
|
15
|
+
if (dispose_and_remove) // modal is already open
|
|
16
|
+
return;
|
|
17
|
+
const modal_els = (0, $cV3wj$createRoot)((dispose)=>{
|
|
18
|
+
let closing_animation;
|
|
19
|
+
let animation_started;
|
|
20
|
+
dispose_and_remove = ()=>{
|
|
21
|
+
const actually_close = ()=>{
|
|
22
|
+
dispose();
|
|
23
|
+
on_dispose?.();
|
|
24
|
+
modal_els.forEach((el)=>el.remove());
|
|
25
|
+
};
|
|
26
|
+
if (animation_started && +new Date() - animation_started > 1000) // Animation broke, close it this time
|
|
27
|
+
actually_close();
|
|
28
|
+
else if (!animation_started && closing_animation) {
|
|
29
|
+
animation_started = +new Date();
|
|
30
|
+
(0, $cV3wj$catchify)(closing_animation)()?.then((0, $cV3wj$catchify)(actually_close));
|
|
31
|
+
} else actually_close();
|
|
32
|
+
};
|
|
33
|
+
return search_modal({
|
|
34
|
+
...modal_fn_opts,
|
|
35
|
+
...extra_options_for_modal,
|
|
36
|
+
close_modal_: close_modal_,
|
|
37
|
+
open_modal_: open_modal_,
|
|
38
|
+
register_closing_animation_: (animation)=>closing_animation = animation
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
body.append(...modal_els);
|
|
42
|
+
};
|
|
43
|
+
const close_modal_ = ()=>{
|
|
44
|
+
if (dispose_and_remove) {
|
|
45
|
+
// modal is open
|
|
46
|
+
const dispose_fn = dispose_and_remove;
|
|
47
|
+
// set dispose function to undefined in case that it triggers this dispose function itself. Not doing it leads to a bug like https://github.com/solidjs/solid/discussions/1194
|
|
48
|
+
dispose_and_remove = undefined;
|
|
49
|
+
dispose_fn();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
open_modal_: open_modal_,
|
|
54
|
+
close_modal_: close_modal_
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
11
61
|
const $19976a74d273070d$var$_tmpl$ = '<path d="M11.669 10.531l9.156-9.156a.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569A.8.8 0 0 0 20.24 0a.77.77 0 0 0-.569.237l-9.14 9.14-9.14-9.14A.79.79 0 0 0 .807 0a.77.77 0 0 0-.569.237A.78.78 0 0 0 0 .807a.77.77 0 0 0 .237.569l9.156 9.156-9.156 9.14c-.159.157-.237.349-.237.569s.079.412.237.569c.085.085.174.148.268.19a1.095 1.095 0 0 0 .316.048.894.894 0 0 0 .285-.048.84.84 0 0 0 .285-.19l9.139-9.14 9.14 9.14a.894.894 0 0 0 .268.19 1.049 1.049 0 0 0 .301.048.941.941 0 0 0 .301-.048.84.84 0 0 0 .285-.19.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569z"></path>';
|
|
12
62
|
function $19976a74d273070d$export$3b621d86b1566b2(props = {}) {
|
|
13
63
|
return (0, $cV3wj$ssrElement)("svg", ()=>({
|
|
@@ -1470,55 +1520,6 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({ number_of_rendered_selected
|
|
|
1470
1520
|
|
|
1471
1521
|
|
|
1472
1522
|
|
|
1473
|
-
async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_opts) {
|
|
1474
|
-
const body = await (0, $cV3wj$observer).wait_for_element("body");
|
|
1475
|
-
let dispose_and_remove;
|
|
1476
|
-
const open_modal_ = (extra_options_for_modal = {}, on_dispose)=>{
|
|
1477
|
-
if (dispose_and_remove) // modal is already open
|
|
1478
|
-
return;
|
|
1479
|
-
const modal_els = (0, $cV3wj$createRoot)((dispose)=>{
|
|
1480
|
-
let closing_animation;
|
|
1481
|
-
let animation_started;
|
|
1482
|
-
dispose_and_remove = ()=>{
|
|
1483
|
-
const actually_close = ()=>{
|
|
1484
|
-
dispose();
|
|
1485
|
-
on_dispose?.();
|
|
1486
|
-
modal_els.forEach((el)=>el.remove());
|
|
1487
|
-
};
|
|
1488
|
-
if (animation_started && +new Date() - animation_started > 1000) // Animation broke, close it this time
|
|
1489
|
-
actually_close();
|
|
1490
|
-
else if (!animation_started && closing_animation) {
|
|
1491
|
-
animation_started = +new Date();
|
|
1492
|
-
(0, $cV3wj$catchify)(closing_animation)()?.then((0, $cV3wj$catchify)(actually_close));
|
|
1493
|
-
} else actually_close();
|
|
1494
|
-
};
|
|
1495
|
-
return search_modal({
|
|
1496
|
-
...modal_fn_opts,
|
|
1497
|
-
...extra_options_for_modal,
|
|
1498
|
-
close_modal_: close_modal_,
|
|
1499
|
-
open_modal_: open_modal_,
|
|
1500
|
-
register_closing_animation_: (animation)=>closing_animation = animation
|
|
1501
|
-
});
|
|
1502
|
-
});
|
|
1503
|
-
body.append(...modal_els);
|
|
1504
|
-
};
|
|
1505
|
-
const close_modal_ = ()=>{
|
|
1506
|
-
if (dispose_and_remove) {
|
|
1507
|
-
// modal is open
|
|
1508
|
-
const dispose_fn = dispose_and_remove;
|
|
1509
|
-
// set dispose function to undefined in case that it triggers this dispose function itself. Not doing it leads to a bug like https://github.com/solidjs/solid/discussions/1194
|
|
1510
|
-
dispose_and_remove = undefined;
|
|
1511
|
-
dispose_fn();
|
|
1512
|
-
}
|
|
1513
|
-
};
|
|
1514
|
-
return {
|
|
1515
|
-
open_modal_: open_modal_,
|
|
1516
|
-
close_modal_: close_modal_
|
|
1517
|
-
};
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
1523
|
|
|
1523
1524
|
|
|
1524
1525
|
|
|
@@ -3901,7 +3902,6 @@ function $0b0380f75d729d63$var$ActualFloatingButtons({ search_filters_open_: [ge
|
|
|
3901
3902
|
|
|
3902
3903
|
|
|
3903
3904
|
|
|
3904
|
-
|
|
3905
3905
|
const $4147651646da990a$var$operator_map = {
|
|
3906
3906
|
"eq": "≡",
|
|
3907
3907
|
"neq": "≠",
|
|
@@ -5073,7 +5073,8 @@ function $ccd5db07a3a069c5$export$477caf01aecaeb2a(options) {
|
|
|
5073
5073
|
router_.navigate_.go_to_({
|
|
5074
5074
|
is_replace_: true,
|
|
5075
5075
|
new_url_: url_object.href,
|
|
5076
|
-
force_spa_navigation_: true
|
|
5076
|
+
force_spa_navigation_: true,
|
|
5077
|
+
scroll: false
|
|
5077
5078
|
});
|
|
5078
5079
|
}, {
|
|
5079
5080
|
defer: true
|
|
@@ -5133,7 +5134,7 @@ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
|
|
|
5133
5134
|
* @param force_spa_navigation_ if you want to force SPA navigation even if on_navigation_ is set to "hard_navigation". You should only set this to true for inter-SDK-page navigations
|
|
5134
5135
|
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
5135
5136
|
* @param category_query_id_ If you are navigating to a category and know the query_id of, please provide it. This is for making a better devEx in js-ui
|
|
5136
|
-
*/ go_to_: (0, $cV3wj$catchify)(async ({ new_url_: raw_new_url , event_: event_ , force_spa_navigation_: force_spa_navigation_ , is_replace_: is_replace_ , category_query_id_: category_query_id_ })=>{
|
|
5137
|
+
*/ go_to_: (0, $cV3wj$catchify)(async ({ new_url_: raw_new_url , event_: event_ , force_spa_navigation_: force_spa_navigation_ , is_replace_: is_replace_ , category_query_id_: category_query_id_ , scroll: scroll = true })=>{
|
|
5137
5138
|
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
5138
5139
|
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
5139
5140
|
if (this.#dont_attempt_navigation(event_)) return;
|
|
@@ -5155,7 +5156,8 @@ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
|
|
|
5155
5156
|
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
5156
5157
|
} else this.#throwing_on_navigation.call(this, {
|
|
5157
5158
|
is_replace: is_replace_,
|
|
5158
|
-
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin)
|
|
5159
|
+
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
|
|
5160
|
+
scroll: scroll
|
|
5159
5161
|
});
|
|
5160
5162
|
await promise;
|
|
5161
5163
|
})
|
|
@@ -7021,6 +7023,26 @@ function $f8c929beb82c512b$export$9dd50d35b9d94fdf({ get_search_query_: get_sear
|
|
|
7021
7023
|
|
|
7022
7024
|
|
|
7023
7025
|
|
|
7026
|
+
|
|
7027
|
+
function $1801dbce7adb3f19$export$41b4894022a3580f({ style_props_: style_props_ = (0, $cV3wj$createSignal)({}) } = {}) {
|
|
7028
|
+
const [, set_style_props] = style_props_;
|
|
7029
|
+
const supports_hover = (0, $dc9262ef6f786812$export$d9f36cf74e24d595)("(hover: hover) and (pointer: fine)");
|
|
7030
|
+
const desktop_short = (0, $dc9262ef6f786812$export$d9f36cf74e24d595)("(max-height: 790px)");
|
|
7031
|
+
const mobile_short = (0, $dc9262ef6f786812$export$d9f36cf74e24d595)("(max-height: 1000px)");
|
|
7032
|
+
const transform_y = (0, $cV3wj$createMemo)(()=>supports_hover() ? !desktop_short() : !mobile_short());
|
|
7033
|
+
set_style_props({
|
|
7034
|
+
position: "fixed",
|
|
7035
|
+
top: "50%"
|
|
7036
|
+
});
|
|
7037
|
+
(0, $cV3wj$createComputed)(()=>set_style_props((old_value)=>({
|
|
7038
|
+
...old_value,
|
|
7039
|
+
transform: transform_y() ? "translateY(-50%)" : "unset"
|
|
7040
|
+
})));
|
|
7041
|
+
return style_props_;
|
|
7042
|
+
}
|
|
7043
|
+
|
|
7044
|
+
|
|
7045
|
+
|
|
7024
7046
|
const $7097477c78a89208$var$_tmpl$ = [
|
|
7025
7047
|
"<div",
|
|
7026
7048
|
' class="filter-results-for-one-row"><!--#-->',
|
|
@@ -7038,8 +7060,7 @@ const $7097477c78a89208$var$_tmpl$ = [
|
|
|
7038
7060
|
"<!--/--><!--#-->",
|
|
7039
7061
|
"<!--/--></div>"
|
|
7040
7062
|
];
|
|
7041
|
-
function $7097477c78a89208$export$a54ec244c8863715(
|
|
7042
|
-
const { depict_api_: depict_api_ , search_field_value_: search_field_value_ , get_search_query_: get_search_query_ , open_modal_: open_modal_ , submit_query_: submit_query_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , expanded_filters_: expanded_filters_ , input_modal_open_: input_modal_open_ , selected_filters_: selected_filters_ , i18n_: i18n_ , make_category_suggestion_card_: make_category_suggestion_card_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , clear_filters_on_next_submit_: clear_filters_on_next_submit_ , local_filter_cache_: local_filter_cache_ , include_input_field_: include_input_field_ , tenant_: tenant_ , market_: market_ , showing_recommendation_rows_: showing_recommendation_rows_ , search_recs_view_more_: search_recs_view_more_ , disable_search_recommendations_: disable_search_recommendations_ , layout_options_: layout_options_ , recommendations_layout_options_: recommendations_layout_options_ = layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ } = opts;
|
|
7063
|
+
function $7097477c78a89208$export$a54ec244c8863715({ depict_api_: depict_api_ , search_field_value_: search_field_value_ , get_search_query_: get_search_query_ , open_modal_: open_modal_ , submit_query_: submit_query_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , expanded_filters_: expanded_filters_ , input_modal_open_: input_modal_open_ , selected_filters_: selected_filters_ , i18n_: i18n_ , make_category_suggestion_card_: make_category_suggestion_card_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , clear_filters_on_next_submit_: clear_filters_on_next_submit_ , local_filter_cache_: local_filter_cache_ , include_input_field_: include_input_field_ , tenant_: tenant_ , market_: market_ , showing_recommendation_rows_: showing_recommendation_rows_ , search_recs_view_more_: search_recs_view_more_ , disable_search_recommendations_: disable_search_recommendations_ , layout_options_: layout_options_ , recommendations_layout_options_: recommendations_layout_options_ = layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ , modal_body_style_ref_: modal_body_style_ref_ }) {
|
|
7043
7064
|
const [get_sorting] = current_sorting_;
|
|
7044
7065
|
const all_products_loaded_ = (0, $cV3wj$createSignal)(false);
|
|
7045
7066
|
const [get_all_products_loaded, set_all_products_loaded] = all_products_loaded_;
|
|
@@ -7092,42 +7113,8 @@ function $7097477c78a89208$export$a54ec244c8863715(opts) {
|
|
|
7092
7113
|
})));
|
|
7093
7114
|
const available_filters_ = (0, $cV3wj$createMemo)(()=>search_results_()?.filters);
|
|
7094
7115
|
const modal_body_style = (0, $cV3wj$createSignal)({});
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
const SafeSearchField = (0, $cV3wj$catchify)((0, $5285d2814d0fac0c$export$b94867ecbd698f21));
|
|
7098
|
-
let input_element;
|
|
7099
|
-
let div_with_field_class;
|
|
7100
|
-
search_field = SafeSearchField({
|
|
7101
|
-
i18n_: i18n_,
|
|
7102
|
-
search_field_value_: search_field_value_,
|
|
7103
|
-
submit_query_: submit_query_,
|
|
7104
|
-
clear_filters_: clear_filters_on_next_submit_,
|
|
7105
|
-
input_field_ref_: (el)=>input_element = el,
|
|
7106
|
-
field_element_ref_: (el)=>div_with_field_class = el,
|
|
7107
|
-
disabled_: true
|
|
7108
|
-
});
|
|
7109
|
-
if (search_field) {
|
|
7110
|
-
opts?.modal_body_style_ref_?.(modal_body_style);
|
|
7111
|
-
const align_position = (0, $cV3wj$catchify)((0, $b6d5529b253681aa$export$b3ad617e9036868))(modal_body_style, search_field, undefined, true);
|
|
7112
|
-
div_with_field_class.addEventListener("click", (0, $cV3wj$catchify)((e)=>{
|
|
7113
|
-
const target = e.target;
|
|
7114
|
-
const sel = ".submit";
|
|
7115
|
-
if (target?.matches?.(sel) || target?.closest?.(sel)) // the search button is just decor, don't do anything when clicked
|
|
7116
|
-
return;
|
|
7117
|
-
// When selecting text in the SearchField that's in the page we want the same selection to persist. It doesn't by itself, since the SearchModal has an entirely different SearchField. Therefore, we manually copy the selection over.
|
|
7118
|
-
const selected_text_range_ = [
|
|
7119
|
-
input_element.selectionStart,
|
|
7120
|
-
input_element.selectionEnd
|
|
7121
|
-
];
|
|
7122
|
-
align_position?.();
|
|
7123
|
-
open_modal_({
|
|
7124
|
-
style_props_: modal_body_style,
|
|
7125
|
-
selected_text_range_: selected_text_range_
|
|
7126
|
-
}, ()=>include_input_field_?.on_close_?.());
|
|
7127
|
-
include_input_field_?.on_open_?.();
|
|
7128
|
-
}));
|
|
7129
|
-
}
|
|
7130
|
-
}
|
|
7116
|
+
const [get_search_field_elements, set_search_field_elements] = (0, $cV3wj$createSignal)();
|
|
7117
|
+
const SafeSearchField = (0, $cV3wj$catchify)((0, $5285d2814d0fac0c$export$b94867ecbd698f21));
|
|
7131
7118
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $cV3wj$createSignal)(false);
|
|
7132
7119
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $cV3wj$createSignal)();
|
|
7133
7120
|
const formatted_number_of_results_ = (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
|
|
@@ -7187,9 +7174,58 @@ function $7097477c78a89208$export$a54ec244c8863715(opts) {
|
|
|
7187
7174
|
get_search_query_();
|
|
7188
7175
|
(0, $d78eea1e8707dc2d$export$c7e181728ad525f)(location);
|
|
7189
7176
|
});
|
|
7177
|
+
(0, $cV3wj$createEffect)(()=>{
|
|
7178
|
+
// reactive include_input_field
|
|
7179
|
+
// this uses ~7 variables from outer scope which is why I didn't refactor it into a function
|
|
7180
|
+
add_input_field: {
|
|
7181
|
+
const input_field_accessor_value = include_input_field_?.() ?? true; // default to showing input field
|
|
7182
|
+
if (!input_field_accessor_value) break add_input_field;
|
|
7183
|
+
let input_element;
|
|
7184
|
+
let div_with_field_class;
|
|
7185
|
+
const search_field = SafeSearchField({
|
|
7186
|
+
i18n_: i18n_,
|
|
7187
|
+
search_field_value_: search_field_value_,
|
|
7188
|
+
submit_query_: submit_query_,
|
|
7189
|
+
clear_filters_: clear_filters_on_next_submit_,
|
|
7190
|
+
input_field_ref_: (el)=>input_element = el,
|
|
7191
|
+
field_element_ref_: (el)=>div_with_field_class = el,
|
|
7192
|
+
disabled_: true
|
|
7193
|
+
});
|
|
7194
|
+
if (!search_field) break add_input_field;
|
|
7195
|
+
modal_body_style[1]({});
|
|
7196
|
+
modal_body_style_ref_?.(modal_body_style);
|
|
7197
|
+
const align_position = (0, $cV3wj$catchify)((0, $b6d5529b253681aa$export$b3ad617e9036868))(modal_body_style, search_field, undefined, true);
|
|
7198
|
+
div_with_field_class.addEventListener("click", (0, $cV3wj$catchify)((e)=>{
|
|
7199
|
+
const target = e.target;
|
|
7200
|
+
const sel = ".submit";
|
|
7201
|
+
if (target?.matches?.(sel) || target?.closest?.(sel)) // the search button is just decor, don't do anything when clicked
|
|
7202
|
+
return;
|
|
7203
|
+
// When selecting text in the SearchField that's in the page we want the same selection to persist. It doesn't by itself, since the SearchModal has an entirely different SearchField. Therefore, we manually copy the selection over.
|
|
7204
|
+
const selected_text_range_ = [
|
|
7205
|
+
input_element.selectionStart,
|
|
7206
|
+
input_element.selectionEnd
|
|
7207
|
+
];
|
|
7208
|
+
align_position?.();
|
|
7209
|
+
open_modal_({
|
|
7210
|
+
style_props_: modal_body_style,
|
|
7211
|
+
selected_text_range_: selected_text_range_
|
|
7212
|
+
}, ()=>input_field_accessor_value?.on_close_?.());
|
|
7213
|
+
input_field_accessor_value?.on_open_?.();
|
|
7214
|
+
}));
|
|
7215
|
+
set_search_field_elements(search_field);
|
|
7216
|
+
return;
|
|
7217
|
+
}
|
|
7218
|
+
// We bailed out of adding the input field
|
|
7219
|
+
set_search_field_elements();
|
|
7220
|
+
// There *might* still be a modal open, either from depict_search.modal_open = true or clicking the SearchField which existed here. Said modal now doesn't have anything to align to anymore - it will still try to align to the style_props_ which it got through the modal_body_style_ref_ which are now no longer updated.
|
|
7221
|
+
// In that case, we write what's needed to center the modal to the modal_body_style for the lifetime of this effect function call to make sure the modal is centered and the UI doesn't look "botched".
|
|
7222
|
+
(0, $1801dbce7adb3f19$export$41b4894022a3580f)({
|
|
7223
|
+
style_props_: modal_body_style
|
|
7224
|
+
});
|
|
7225
|
+
});
|
|
7190
7226
|
return [
|
|
7191
7227
|
(0, $cV3wj$isServer) ? "<!-- Search page based on Depict SDK -->" : document.createComment("Search page based on Depict SDK"),
|
|
7192
|
-
(0, $cV3wj$ssr)($7097477c78a89208$var$_tmpl$2, (0, $cV3wj$ssrHydrationKey)() + (0, $cV3wj$ssrAttribute)("id", (0, $cV3wj$escape)((0, $f86ba724282f6690$export$44dad306455dddf).SEARCH_PAGE, true), false), (0, $cV3wj$escape)(
|
|
7228
|
+
(0, $cV3wj$ssr)($7097477c78a89208$var$_tmpl$2, (0, $cV3wj$ssrHydrationKey)() + (0, $cV3wj$ssrAttribute)("id", (0, $cV3wj$escape)((0, $f86ba724282f6690$export$44dad306455dddf).SEARCH_PAGE, true), false), (0, $cV3wj$escape)(get_search_field_elements()), make_category_suggestion_card_ ? (0, $cV3wj$escape)((0, $cV3wj$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
7193
7229
|
severity_: "error",
|
|
7194
7230
|
message_: "Category suggestions failed",
|
|
7195
7231
|
get children () {
|
|
@@ -7305,7 +7341,6 @@ function $7097477c78a89208$export$a54ec244c8863715(opts) {
|
|
|
7305
7341
|
|
|
7306
7342
|
|
|
7307
7343
|
|
|
7308
|
-
|
|
7309
7344
|
function $4ca91518c9a35379$export$828dcdd425fd3231(aligner) {
|
|
7310
7345
|
const style_element = document.createElement("style");
|
|
7311
7346
|
document.head.append(style_element);
|
|
@@ -7331,6 +7366,7 @@ function $4ca91518c9a35379$export$828dcdd425fd3231(aligner) {
|
|
|
7331
7366
|
|
|
7332
7367
|
|
|
7333
7368
|
|
|
7369
|
+
|
|
7334
7370
|
const $806c97b931758897$var$_tmpl$ = [
|
|
7335
7371
|
"<div",
|
|
7336
7372
|
' class="depict plp search">',
|
|
@@ -7478,18 +7514,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
|
|
|
7478
7514
|
return;
|
|
7479
7515
|
}
|
|
7480
7516
|
// Open centered modal
|
|
7481
|
-
const
|
|
7482
|
-
const desktop_short = (0, $dc9262ef6f786812$export$d9f36cf74e24d595)("(max-height: 790px)");
|
|
7483
|
-
const mobile_short = (0, $dc9262ef6f786812$export$d9f36cf74e24d595)("(max-height: 1000px)");
|
|
7484
|
-
const transform_y = (0, $cV3wj$createMemo)(()=>supports_hover() ? !desktop_short() : !mobile_short());
|
|
7485
|
-
const style_props_ = (0, $cV3wj$createSignal)({
|
|
7486
|
-
position: "fixed",
|
|
7487
|
-
top: "50%"
|
|
7488
|
-
});
|
|
7489
|
-
(0, $cV3wj$createComputed)(()=>style_props_[1]((old_value)=>({
|
|
7490
|
-
...old_value,
|
|
7491
|
-
transform: transform_y() ? "translateY(-50%)" : "unset"
|
|
7492
|
-
})));
|
|
7517
|
+
const style_props_ = (0, $1801dbce7adb3f19$export$41b4894022a3580f)();
|
|
7493
7518
|
if (signal_value_is_options) {
|
|
7494
7519
|
const [options_arg, ...rest] = open_signal_value;
|
|
7495
7520
|
open_modal_({
|
|
@@ -7557,7 +7582,8 @@ function $806c97b931758897$var$get_shared_properties(depict_search) {
|
|
|
7557
7582
|
if (!shared_properties) throw new Error("Can't connect to provided DepictSearch instance");
|
|
7558
7583
|
return shared_properties;
|
|
7559
7584
|
}
|
|
7560
|
-
function $806c97b931758897$export$f2dc7e4e4aa11abb(
|
|
7585
|
+
function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
|
|
7586
|
+
const { depict_search: depict_search , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , extra_depict_options: extra_depict_options } = props;
|
|
7561
7587
|
const shared_properties = $806c97b931758897$var$get_shared_properties(depict_search);
|
|
7562
7588
|
const grid_spacing_override = typeof grid_spacing === "string" ? {
|
|
7563
7589
|
grid_spacing: grid_spacing
|
|
@@ -7611,7 +7637,7 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
|
|
|
7611
7637
|
selected_filters_: shared_properties.selected_filters_,
|
|
7612
7638
|
showing_recommendation_rows_: state_.search_showing_recommendation_rows,
|
|
7613
7639
|
scroll_restoration_data_: state_.search_scroll_restoration_data,
|
|
7614
|
-
include_input_field_: include_input_field,
|
|
7640
|
+
include_input_field_: ()=>props.include_input_field,
|
|
7615
7641
|
layout_options_: {
|
|
7616
7642
|
cols_at_size: (0, $b5cccc8ee7d24677$export$6daf8749b65a1b77)(cols_at_size),
|
|
7617
7643
|
...grid_spacing_override
|
|
@@ -7989,4 +8015,4 @@ const $4690a06c8489dcd0$export$7bf543b9d9be2c22 = (0, $e4615ecd1849548f$export$b
|
|
|
7989
8015
|
(0, $cV3wj$add_to_version_info)("ui", (0, $ec291e0010116877$export$83d89fbfd8236492));
|
|
7990
8016
|
|
|
7991
8017
|
|
|
7992
|
-
export {$19976a74d273070d$export$3b621d86b1566b2 as CrossIcon, $fbbadcb080ad1d4a$export$8be2714ec7f169ee as GenericSliderArrowButton, $c58717f39bf51647$export$58e808b1db15d3bc as fetchDepictRecommendations, $961b5c64bef4662f$export$de035477d6fef996 as QuickLinks, $961b5c64bef4662f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a79d86d64fb64e8e$export$824dde41348efed1 as embedded_num_products, $5c5f95951393e5d1$export$643598a327b5833e as get_categories, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $961b5c64bef4662f$export$e2bf8ce7779e827e as CategoryPage, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $806c97b931758897$export$316f6f283ae64765 as SearchField, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $d20eff0aadc28983$export$acb3eaade4b23afd as BasePlaceholder, $d134eae24341b4a1$export$89c6019e4baa40b1 as TextPlaceholder, $7f60f09116a3fe61$export$3f37af283f8fb843 as ImagePlaceholder, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version};
|
|
8018
|
+
export {$194bd6b8e4c59830$export$79b1565500412d9b as general_modal_abstraction, $19976a74d273070d$export$3b621d86b1566b2 as CrossIcon, $fbbadcb080ad1d4a$export$8be2714ec7f169ee as GenericSliderArrowButton, $c58717f39bf51647$export$58e808b1db15d3bc as fetchDepictRecommendations, $961b5c64bef4662f$export$de035477d6fef996 as QuickLinks, $961b5c64bef4662f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a79d86d64fb64e8e$export$824dde41348efed1 as embedded_num_products, $5c5f95951393e5d1$export$643598a327b5833e as get_categories, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $961b5c64bef4662f$export$e2bf8ce7779e827e as CategoryPage, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $806c97b931758897$export$316f6f283ae64765 as SearchField, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $d20eff0aadc28983$export$acb3eaade4b23afd as BasePlaceholder, $d134eae24341b4a1$export$89c6019e4baa40b1 as TextPlaceholder, $7f60f09116a3fe61$export$3f37af283f8fb843 as ImagePlaceholder, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version};
|
package/package.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
|
|
5
5
|
"packageManager": "yarn@3.2.2",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"src/locales/index.ts"
|
|
9
|
-
],
|
|
10
|
-
"main": "dist/main.js",
|
|
11
|
-
"module": "dist/module.js",
|
|
6
|
+
"main": "dist/client/main.js",
|
|
7
|
+
"module": "dist/client/module.js",
|
|
12
8
|
"sass": "styles.scss",
|
|
13
9
|
"context": "node",
|
|
14
10
|
"engines": {
|
|
@@ -33,18 +29,6 @@
|
|
|
33
29
|
"Carl Riis <carl@depict.ai>"
|
|
34
30
|
],
|
|
35
31
|
"targets": {
|
|
36
|
-
"module": {
|
|
37
|
-
"isLibrary": true,
|
|
38
|
-
"source": "src/index.ts",
|
|
39
|
-
"optimize": false,
|
|
40
|
-
"context": "node"
|
|
41
|
-
},
|
|
42
|
-
"main": {
|
|
43
|
-
"isLibrary": true,
|
|
44
|
-
"source": "src/index.ts",
|
|
45
|
-
"optimize": false,
|
|
46
|
-
"context": "node"
|
|
47
|
-
},
|
|
48
32
|
"localesModule": {
|
|
49
33
|
"isLibrary": true,
|
|
50
34
|
"optimize": false,
|
|
@@ -61,7 +45,38 @@
|
|
|
61
45
|
"outputFormat": "commonjs",
|
|
62
46
|
"context": "node"
|
|
63
47
|
},
|
|
64
|
-
"
|
|
48
|
+
"client_esmodule": {
|
|
49
|
+
"isLibrary": true,
|
|
50
|
+
"source": "src/index.ts",
|
|
51
|
+
"optimize": false,
|
|
52
|
+
"outputFormat": "esmodule",
|
|
53
|
+
"context": "node",
|
|
54
|
+
"distDir": "dist/client/esmodule"
|
|
55
|
+
},
|
|
56
|
+
"client_commonjs": {
|
|
57
|
+
"isLibrary": true,
|
|
58
|
+
"source": "src/index.ts",
|
|
59
|
+
"optimize": false,
|
|
60
|
+
"context": "node",
|
|
61
|
+
"outputFormat": "commonjs",
|
|
62
|
+
"distDir": "dist/client/commonjs"
|
|
63
|
+
},
|
|
64
|
+
"server_esmodule": {
|
|
65
|
+
"isLibrary": true,
|
|
66
|
+
"source": "src/index.ts",
|
|
67
|
+
"optimize": false,
|
|
68
|
+
"outputFormat": "esmodule",
|
|
69
|
+
"context": "node",
|
|
70
|
+
"distDir": "dist/server/esmodule"
|
|
71
|
+
},
|
|
72
|
+
"server_commonjs": {
|
|
73
|
+
"isLibrary": true,
|
|
74
|
+
"source": "src/index.ts",
|
|
75
|
+
"optimize": false,
|
|
76
|
+
"context": "node",
|
|
77
|
+
"outputFormat": "commonjs",
|
|
78
|
+
"distDir": "dist/server/commonjs"
|
|
79
|
+
}
|
|
65
80
|
},
|
|
66
81
|
"files": [
|
|
67
82
|
"/dist",
|
|
@@ -72,10 +87,17 @@
|
|
|
72
87
|
"exports": {
|
|
73
88
|
"./styles.scss": "./styles.scss",
|
|
74
89
|
".": {
|
|
75
|
-
"import": "./dist/module.js",
|
|
76
|
-
"require": "./dist/main.js",
|
|
77
90
|
"types": "./dist/index.d.ts",
|
|
78
|
-
"
|
|
91
|
+
"browser": {
|
|
92
|
+
"import": "./dist/client/module.js",
|
|
93
|
+
"require": "./dist/client/main.js",
|
|
94
|
+
"default": "./dist/client/module.js"
|
|
95
|
+
},
|
|
96
|
+
"node": {
|
|
97
|
+
"import": "./dist/server/module.js",
|
|
98
|
+
"require": "./dist/server/main.js",
|
|
99
|
+
"default": "./dist/server/module.js"
|
|
100
|
+
}
|
|
79
101
|
},
|
|
80
102
|
"./locales": {
|
|
81
103
|
"types": "./locales/index.d.ts",
|
|
@@ -102,10 +124,11 @@
|
|
|
102
124
|
"ts-jest": "^29.0.3"
|
|
103
125
|
},
|
|
104
126
|
"dependencies": {
|
|
105
|
-
"@depict-ai/plp-styling": "^1.0.
|
|
106
|
-
"@depict-ai/types": "^1.0.
|
|
107
|
-
"@depict-ai/utilishared": "^1.0.
|
|
127
|
+
"@depict-ai/plp-styling": "^1.0.19",
|
|
128
|
+
"@depict-ai/types": "^1.0.22",
|
|
129
|
+
"@depict-ai/utilishared": "^1.0.18",
|
|
108
130
|
"solid-js": "^1.7.3"
|
|
109
131
|
},
|
|
110
|
-
"types": "dist/index.d.ts"
|
|
132
|
+
"types": "dist/index.d.ts",
|
|
133
|
+
"type": "module"
|
|
111
134
|
}
|