@depict-ai/ui 2.0.1 → 2.0.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/ES10/index.cjs +207 -79
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +207 -79
- package/latest/index.cjs +201 -76
- package/latest/index.d.ts +1 -1
- package/latest/index.js +201 -76
- package/package.json +2 -2
- package/server/ES10/index.cjs +162 -27
- package/server/ES10/index.d.ts +1 -1
- package/server/ES10/index.js +162 -27
- package/server/latest/index.cjs +156 -24
- package/server/latest/index.d.ts +1 -1
- package/server/latest/index.js +156 -24
package/server/ES10/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import $b8hua$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
|
|
|
8
8
|
/*! Depict.ai search and product listing SDK */
|
|
9
9
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
10
10
|
register_es_version("ui", "ES10");
|
|
11
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0.
|
|
11
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0.2";
|
|
12
12
|
const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
|
|
13
13
|
const cols_at_size = [];
|
|
14
14
|
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
@@ -1070,9 +1070,9 @@ function $4711a82d08d2021b$export$fecbb157621501bd(_ref) {
|
|
|
1070
1070
|
}));
|
|
1071
1071
|
return outmost_element;
|
|
1072
1072
|
}
|
|
1073
|
-
const $
|
|
1074
|
-
$
|
|
1075
|
-
const $
|
|
1073
|
+
const $19e828709c7723a0$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
|
|
1074
|
+
$19e828709c7723a0$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--#-->", "<!--/--></label>"];
|
|
1075
|
+
const $19e828709c7723a0$export$48513f6b9f8ce62d = props => {
|
|
1076
1076
|
// 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
|
|
1077
1077
|
const count = $b8hua$createMemo(() => props.count_);
|
|
1078
1078
|
const label = $b8hua$createMemo(() => props.label_);
|
|
@@ -1080,12 +1080,12 @@ const $6b73914551534ea8$export$48513f6b9f8ce62d = props => {
|
|
|
1080
1080
|
const value = $b8hua$createMemo(() => props.value_);
|
|
1081
1081
|
const is_count_zero = $b8hua$createMemo(() => props.is_count_zero_ || count() === 0);
|
|
1082
1082
|
const id = $b8hua$make_random_classname();
|
|
1083
|
-
return (/* We can't use actual margin because ExpandingContainer gets messed up */$b8hua$ssr($
|
|
1083
|
+
return (/* We can't use actual margin because ExpandingContainer gets messed up */$b8hua$ssr($19e828709c7723a0$var$_tmpl$2, $b8hua$ssrHydrationKey(), "input-row ".concat(is_count_zero() ? "count-0" : ""), $b8hua$ssrAttribute("for", $b8hua$escape(id, true), false), $b8hua$ssrAttribute("name", $b8hua$escape(value(), true), false) + $b8hua$ssrAttribute("id", $b8hua$escape(id, true), false), $b8hua$ssrAttribute("checked", checked(), true), $b8hua$ssrAttribute("disabled", !checked() && is_count_zero(), true), $b8hua$escape(label()) || $b8hua$escape(value()), $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
|
|
1084
1084
|
get when() {
|
|
1085
1085
|
return count() != undefined;
|
|
1086
1086
|
},
|
|
1087
1087
|
get children() {
|
|
1088
|
-
return $b8hua$ssr($
|
|
1088
|
+
return $b8hua$ssr($19e828709c7723a0$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape(count()));
|
|
1089
1089
|
}
|
|
1090
1090
|
})))
|
|
1091
1091
|
);
|
|
@@ -1144,7 +1144,7 @@ function $133484ef10e4e954$export$dd948f91abc3a1c4(_ref) {
|
|
|
1144
1144
|
});
|
|
1145
1145
|
const render_checkbox = checkbox => {
|
|
1146
1146
|
// Checkbox always calls the getters in props, so we don't wrap these values into memos
|
|
1147
|
-
return $b8hua$createComponent((0, $
|
|
1147
|
+
return $b8hua$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
|
|
1148
1148
|
get value_() {
|
|
1149
1149
|
return checkbox().value_;
|
|
1150
1150
|
},
|
|
@@ -1652,7 +1652,7 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
1652
1652
|
var _value;
|
|
1653
1653
|
return !!Object.keys(((_value = value()) === null || _value === void 0 ? void 0 : _value.children_) || {}).length;
|
|
1654
1654
|
});
|
|
1655
|
-
return $b8hua$ssr($0ae614c5c7babb43$var$_tmpl$2, $b8hua$ssrHydrationKey(), "checkbox-details ".concat(has_expandable() ? "expandable" : ""), $b8hua$escape($b8hua$createComponent((0, $
|
|
1655
|
+
return $b8hua$ssr($0ae614c5c7babb43$var$_tmpl$2, $b8hua$ssrHydrationKey(), "checkbox-details ".concat(has_expandable() ? "expandable" : ""), $b8hua$escape($b8hua$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
|
|
1656
1656
|
get value_() {
|
|
1657
1657
|
var _value2;
|
|
1658
1658
|
return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
|
|
@@ -1923,9 +1923,26 @@ function $0ae614c5c7babb43$var$expand_until_choice(data_structure) {
|
|
|
1923
1923
|
}
|
|
1924
1924
|
});
|
|
1925
1925
|
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1926
|
+
|
|
1927
|
+
/** @jsxImportSource solid-js */
|
|
1928
|
+
|
|
1929
|
+
function $0dc044cffe1e825b$export$9f191182275e9ef(what_to_watch) {
|
|
1930
|
+
const [size, setSize] = $b8hua$createSignal();
|
|
1931
|
+
const resizeObserver = new ResizeObserver($b8hua$catchify(records => {
|
|
1932
|
+
for (let j = 0; j < records.length; j++) {
|
|
1933
|
+
var _records$j$borderBoxS, _records$j$borderBoxS2, _records$j$borderBoxS3;
|
|
1934
|
+
const width = (_records$j$borderBoxS = (_records$j$borderBoxS2 = records[j].borderBoxSize) === null || _records$j$borderBoxS2 === void 0 ? void 0 : (_records$j$borderBoxS3 = _records$j$borderBoxS2[0]) === null || _records$j$borderBoxS3 === void 0 ? void 0 : _records$j$borderBoxS3.inlineSize) !== null && _records$j$borderBoxS !== void 0 ? _records$j$borderBoxS : what_to_watch.getBoundingClientRect().width;
|
|
1935
|
+
setSize(width);
|
|
1936
|
+
}
|
|
1937
|
+
}));
|
|
1938
|
+
resizeObserver.observe(what_to_watch);
|
|
1939
|
+
$b8hua$onCleanup(() => resizeObserver.disconnect());
|
|
1940
|
+
return size;
|
|
1941
|
+
}
|
|
1942
|
+
const $830ea8efda59884e$var$_tmpl$ = ["<div", ' class="checkbox-grid" style="position:absolute;z-index:-1;pointer-events:none;opacity:0">', "</div>"],
|
|
1943
|
+
$830ea8efda59884e$var$_tmpl$2 = ["<span", ' class="count-wrapper"><span class="count">', "</span></span>"];
|
|
1944
|
+
const $830ea8efda59884e$var$gap_px = 5;
|
|
1945
|
+
const $830ea8efda59884e$var$max_columns = 3;
|
|
1929
1946
|
const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
|
|
1930
1947
|
let {
|
|
1931
1948
|
filter_: filter_,
|
|
@@ -1955,26 +1972,144 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
|
|
|
1955
1972
|
};
|
|
1956
1973
|
});
|
|
1957
1974
|
});
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1975
|
+
const [sizes_set, set_sizes_set] = $b8hua$createSignal(new Set(), {
|
|
1976
|
+
equals: false
|
|
1977
|
+
});
|
|
1978
|
+
const [cols_at_size, set_cols_at_size] = $b8hua$createSignal([[1, "0px", ""]]);
|
|
1979
|
+
const [container, set_container] = $b8hua$createSignal();
|
|
1980
|
+
const container_width_accessor = $b8hua$createMemo(() => {
|
|
1981
|
+
const element = container();
|
|
1982
|
+
if (!element) return;
|
|
1983
|
+
return $0dc044cffe1e825b$export$9f191182275e9ef(element);
|
|
1984
|
+
});
|
|
1985
|
+
const [shadow_children, set_shadow_children] = $b8hua$createSignal(new Set(), {
|
|
1986
|
+
equals: false
|
|
1987
|
+
});
|
|
1988
|
+
const shadow_grid = $b8hua$ssr($830ea8efda59884e$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape([...shadow_children()])); // for getting the smallest possible sizes of all the items
|
|
1989
|
+
$b8hua$createEffect(() => {
|
|
1990
|
+
var _container_width_acce;
|
|
1991
|
+
const container_width = (_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce();
|
|
1992
|
+
if (container_width == undefined) return;
|
|
1993
|
+
$830ea8efda59884e$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
|
|
1994
|
+
});
|
|
1995
|
+
return [shadow_grid, $b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
|
|
1996
|
+
get cols_at_size() {
|
|
1997
|
+
return cols_at_size();
|
|
1961
1998
|
},
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1999
|
+
grid_spacing: $830ea8efda59884e$var$gap_px + "px",
|
|
2000
|
+
rows: "all",
|
|
2001
|
+
layout: "grid",
|
|
2002
|
+
element_attributes: {
|
|
2003
|
+
class: "checkbox-grid",
|
|
2004
|
+
ref: el => set_container(el)
|
|
2005
|
+
},
|
|
2006
|
+
get children() {
|
|
2007
|
+
return $b8hua$createComponent((0, $b8hua$Index), {
|
|
2008
|
+
get each() {
|
|
2009
|
+
return buttons();
|
|
1970
2010
|
},
|
|
1971
|
-
|
|
1972
|
-
|
|
2011
|
+
children: value => {
|
|
2012
|
+
const is_selected = $b8hua$createMemo(() => {
|
|
2013
|
+
var _existing_filter, _existing_filter$data;
|
|
2014
|
+
return (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : (_existing_filter$data = _existing_filter.data) === null || _existing_filter$data === void 0 ? void 0 : _existing_filter$data.includes(value().value_);
|
|
2015
|
+
});
|
|
2016
|
+
const MakeButton = attributes => $b8hua$ssrElement("button", () => ({
|
|
2017
|
+
...attributes,
|
|
2018
|
+
"disabled": value().count_ === 0 && !is_selected(),
|
|
2019
|
+
"classList": {
|
|
2020
|
+
minor: !is_selected(),
|
|
2021
|
+
major: is_selected(),
|
|
2022
|
+
"major-minor-transition": true
|
|
2023
|
+
}
|
|
2024
|
+
}), () => ["<!--#-->", $b8hua$escape(value().value_), "<!--/-->", "<!--#-->", $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
|
|
2025
|
+
get when() {
|
|
2026
|
+
return value().count_ != undefined;
|
|
2027
|
+
},
|
|
2028
|
+
get children() {
|
|
2029
|
+
return $b8hua$ssr($830ea8efda59884e$var$_tmpl$2, $b8hua$ssrHydrationKey(), $b8hua$escape(value().count_));
|
|
2030
|
+
}
|
|
2031
|
+
})), "<!--/-->"], true);
|
|
2032
|
+
const invisible_size_button = $b8hua$createComponent(MakeButton, {});
|
|
2033
|
+
const smallest_possible_size = $0dc044cffe1e825b$export$9f191182275e9ef(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
|
|
2034
|
+
const sizes_value = $b8hua$untrack(sizes_set);
|
|
2035
|
+
const shadow_children_value = $b8hua$untrack(shadow_children);
|
|
2036
|
+
sizes_value.add(smallest_possible_size);
|
|
2037
|
+
set_sizes_set(sizes_value);
|
|
2038
|
+
shadow_children_value.add(invisible_size_button);
|
|
2039
|
+
set_shadow_children(shadow_children_value);
|
|
2040
|
+
$b8hua$onCleanup(() => {
|
|
2041
|
+
const sizes_value = $b8hua$untrack(sizes_set);
|
|
2042
|
+
const shadow_children_value = $b8hua$untrack(shadow_children);
|
|
2043
|
+
sizes_value.delete(smallest_possible_size);
|
|
2044
|
+
set_sizes_set(sizes_value);
|
|
2045
|
+
shadow_children_value.delete(invisible_size_button);
|
|
2046
|
+
set_shadow_children(shadow_children_value);
|
|
2047
|
+
});
|
|
2048
|
+
// The actual button that will be visible
|
|
2049
|
+
return $b8hua$createComponent(MakeButton, {});
|
|
1973
2050
|
}
|
|
1974
|
-
})
|
|
2051
|
+
});
|
|
1975
2052
|
}
|
|
1976
|
-
})
|
|
2053
|
+
})];
|
|
1977
2054
|
};
|
|
2055
|
+
/**
|
|
2056
|
+
* Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
|
|
2057
|
+
*/
|
|
2058
|
+
function $830ea8efda59884e$var$adjust_sizes(container_width, sizes, set_cols_at_size) {
|
|
2059
|
+
let current_row_index = 0;
|
|
2060
|
+
let current_row_items = [];
|
|
2061
|
+
const column_to_row_result = {};
|
|
2062
|
+
const check_would_fit_evenly = (min_size_of_item, at_number_of_columnns) => {
|
|
2063
|
+
const would_have_even_size = container_width / at_number_of_columnns - (at_number_of_columnns * 2 - 2) * ($830ea8efda59884e$var$gap_px / 2) / at_number_of_columnns; // What size would our element have (without gaps), given that now every column had the same width (equation from Layout.tsx)
|
|
2064
|
+
return would_have_even_size >= min_size_of_item; // would this item still fit if we added another column? (probably what the caller has done with at_number_of_columns), given that every item has the same size
|
|
2065
|
+
};
|
|
2066
|
+
|
|
2067
|
+
for (const size_item of sizes) {
|
|
2068
|
+
const size = size_item();
|
|
2069
|
+
if (size == undefined) return; // Only do stuff if we know all the sizes
|
|
2070
|
+
const current_row_length = current_row_items.length;
|
|
2071
|
+
const can_add_another_column_initial_val = current_row_length < $830ea8efda59884e$var$max_columns; // allow max 4 items per row
|
|
2072
|
+
let can_add_another_column = can_add_another_column_initial_val;
|
|
2073
|
+
if (can_add_another_column)
|
|
2074
|
+
// can we actually? Since adding another column changes the size of all elements in the row we need to check all of them
|
|
2075
|
+
for (let i = -1; i < current_row_length; i++) {
|
|
2076
|
+
var _ref3;
|
|
2077
|
+
// -1 is for the new item we're adding and every item is guaranteed to exist
|
|
2078
|
+
const size_to_check = (_ref3 = current_row_items[i]) !== null && _ref3 !== void 0 ? _ref3 : size;
|
|
2079
|
+
const would_have_columns = current_row_length + 1; // if we added another column
|
|
2080
|
+
const would_fit_evenly = check_would_fit_evenly(size_to_check, would_have_columns); // see comments in check_would_fit_evenly
|
|
2081
|
+
if (!would_fit_evenly) {
|
|
2082
|
+
can_add_another_column = false;
|
|
2083
|
+
break;
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
if (can_add_another_column) current_row_items.push(size);else {
|
|
2087
|
+
column_to_row_result[++current_row_index] = current_row_length || 1; // overrides is indexed by 1 it seems, therefore ++curent_row_index
|
|
2088
|
+
current_row_items = [size]; // save current item for next row
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
const items_left_to_add = current_row_items.length;
|
|
2093
|
+
if (items_left_to_add) {
|
|
2094
|
+
let num_columns = 1; // We want to have as close to max_columns as possible in the last row
|
|
2095
|
+
let fits = true;
|
|
2096
|
+
do
|
|
2097
|
+
// Check if more columns would fit
|
|
2098
|
+
for (let i = 0; i < items_left_to_add; i++) {
|
|
2099
|
+
const item = current_row_items[i];
|
|
2100
|
+
const would_fit_evenly = check_would_fit_evenly(item, num_columns + 1);
|
|
2101
|
+
if (!would_fit_evenly) {
|
|
2102
|
+
fits = false;
|
|
2103
|
+
break;
|
|
2104
|
+
}
|
|
2105
|
+
} while (fits && ++num_columns < $830ea8efda59884e$var$max_columns);
|
|
2106
|
+
column_to_row_result[++current_row_index] = num_columns; // Add last row that's left after loop finished
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
set_cols_at_size([[1, "0px", "", null, {
|
|
2110
|
+
overrides: column_to_row_result
|
|
2111
|
+
}]]);
|
|
2112
|
+
}
|
|
1978
2113
|
function $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query) {
|
|
1979
2114
|
const signal = $b8hua$createSignal(false);
|
|
1980
2115
|
$b8hua$onCleanup($b8hua$javascript_media_query(media_query, _ref => {
|
|
@@ -2033,7 +2168,7 @@ function $2cb856c297c53e6c$export$82ed4b28ecb67608(_ref) {
|
|
|
2033
2168
|
});
|
|
2034
2169
|
const rgb_color = $b8hua$createMemo(() => $b8hua$hex_to_rgb(hex_color()));
|
|
2035
2170
|
const black_contrast_better = $b8hua$createMemo(() => rgb_color() ? $2cb856c297c53e6c$var$does_black_contrast_better(rgb_color()) : false);
|
|
2036
|
-
const input_row = $b8hua$createComponent((0, $
|
|
2171
|
+
const input_row = $b8hua$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
|
|
2037
2172
|
get value_() {
|
|
2038
2173
|
return checkbox().value_;
|
|
2039
2174
|
},
|
package/server/latest/index.cjs
CHANGED
|
@@ -60,7 +60,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
60
60
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
61
61
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
62
62
|
/*! Depict.ai search and product listing SDK */
|
|
63
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.
|
|
63
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.2";
|
|
64
64
|
const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
|
|
65
65
|
const cols_at_size = [];
|
|
66
66
|
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
@@ -1061,9 +1061,9 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
|
|
|
1061
1061
|
}));
|
|
1062
1062
|
return outmost_element;
|
|
1063
1063
|
}
|
|
1064
|
-
const $
|
|
1065
|
-
$
|
|
1066
|
-
const $
|
|
1064
|
+
const $1c63082b2da848ad$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
|
|
1065
|
+
$1c63082b2da848ad$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--#-->", "<!--/--></label>"];
|
|
1066
|
+
const $1c63082b2da848ad$export$48513f6b9f8ce62d = props => {
|
|
1067
1067
|
// 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
|
|
1068
1068
|
const count = $5vyXB$solidjs.createMemo(() => props.count_);
|
|
1069
1069
|
const label = $5vyXB$solidjs.createMemo(() => props.label_);
|
|
@@ -1071,12 +1071,12 @@ const $b3cf6ca8dc0e9998$export$48513f6b9f8ce62d = props => {
|
|
|
1071
1071
|
const value = $5vyXB$solidjs.createMemo(() => props.value_);
|
|
1072
1072
|
const is_count_zero = $5vyXB$solidjs.createMemo(() => props.is_count_zero_ || count() === 0);
|
|
1073
1073
|
const id = $5vyXB$depictaiutilishared.make_random_classname();
|
|
1074
|
-
return (/* We can't use actual margin because ExpandingContainer gets messed up */$5vyXB$solidjsweb.ssr($
|
|
1074
|
+
return (/* We can't use actual margin because ExpandingContainer gets messed up */$5vyXB$solidjsweb.ssr($1c63082b2da848ad$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), `input-row ${is_count_zero() ? "count-0" : ""}`, $5vyXB$solidjsweb.ssrAttribute("for", $5vyXB$solidjsweb.escape(id, true), false), $5vyXB$solidjsweb.ssrAttribute("name", $5vyXB$solidjsweb.escape(value(), true), false) + $5vyXB$solidjsweb.ssrAttribute("id", $5vyXB$solidjsweb.escape(id, true), false), $5vyXB$solidjsweb.ssrAttribute("checked", checked(), true), $5vyXB$solidjsweb.ssrAttribute("disabled", !checked() && is_count_zero(), true), $5vyXB$solidjsweb.escape(label()) || $5vyXB$solidjsweb.escape(value()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
1075
1075
|
get when() {
|
|
1076
1076
|
return count() != undefined;
|
|
1077
1077
|
},
|
|
1078
1078
|
get children() {
|
|
1079
|
-
return $5vyXB$solidjsweb.ssr($
|
|
1079
|
+
return $5vyXB$solidjsweb.ssr($1c63082b2da848ad$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(count()));
|
|
1080
1080
|
}
|
|
1081
1081
|
})))
|
|
1082
1082
|
);
|
|
@@ -1127,7 +1127,7 @@ function $d94869c80e337a3d$export$dd948f91abc3a1c4({
|
|
|
1127
1127
|
});
|
|
1128
1128
|
const render_checkbox = checkbox => {
|
|
1129
1129
|
// Checkbox always calls the getters in props, so we don't wrap these values into memos
|
|
1130
|
-
return $5vyXB$solidjsweb.createComponent((0, $
|
|
1130
|
+
return $5vyXB$solidjsweb.createComponent((0, $1c63082b2da848ad$export$48513f6b9f8ce62d), {
|
|
1131
1131
|
get value_() {
|
|
1132
1132
|
return checkbox().value_;
|
|
1133
1133
|
},
|
|
@@ -1601,7 +1601,7 @@ function $3bdc00a1353c1150$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
1601
1601
|
// for some reason the for thing doesn't dispose of us if the key no longer exists?? so I'm doing it with show instead
|
|
1602
1602
|
const value = $5vyXB$solidjs.createMemo(() => data()[key]); // still sometimes get undefined here even though we have <Show>
|
|
1603
1603
|
const has_expandable = $5vyXB$solidjs.createMemo(() => !!Object.keys(value()?.children_ || {}).length);
|
|
1604
|
-
return $5vyXB$solidjsweb.ssr($3bdc00a1353c1150$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), `checkbox-details ${has_expandable() ? "expandable" : ""}`, $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $
|
|
1604
|
+
return $5vyXB$solidjsweb.ssr($3bdc00a1353c1150$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), `checkbox-details ${has_expandable() ? "expandable" : ""}`, $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $1c63082b2da848ad$export$48513f6b9f8ce62d), {
|
|
1605
1605
|
get value_() {
|
|
1606
1606
|
return JSON.stringify(value()?.value_);
|
|
1607
1607
|
},
|
|
@@ -1841,9 +1841,25 @@ function $3bdc00a1353c1150$var$expand_until_choice(data_structure) {
|
|
|
1841
1841
|
}
|
|
1842
1842
|
});
|
|
1843
1843
|
}
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1844
|
+
|
|
1845
|
+
/** @jsxImportSource solid-js */
|
|
1846
|
+
|
|
1847
|
+
function $e5f442fb78c98741$export$9f191182275e9ef(what_to_watch) {
|
|
1848
|
+
const [size, setSize] = $5vyXB$solidjs.createSignal();
|
|
1849
|
+
const resizeObserver = new ResizeObserver($5vyXB$depictaiutilishared.catchify(records => {
|
|
1850
|
+
for (let j = 0; j < records.length; j++) {
|
|
1851
|
+
const width = records[j].borderBoxSize?.[0]?.inlineSize ?? what_to_watch.getBoundingClientRect().width;
|
|
1852
|
+
setSize(width);
|
|
1853
|
+
}
|
|
1854
|
+
}));
|
|
1855
|
+
resizeObserver.observe(what_to_watch);
|
|
1856
|
+
$5vyXB$solidjs.onCleanup(() => resizeObserver.disconnect());
|
|
1857
|
+
return size;
|
|
1858
|
+
}
|
|
1859
|
+
const $0ef1681699140f1a$var$_tmpl$ = ["<div", ' class="checkbox-grid" style="position:absolute;z-index:-1;pointer-events:none;opacity:0">', "</div>"],
|
|
1860
|
+
$0ef1681699140f1a$var$_tmpl$2 = ["<span", ' class="count-wrapper"><span class="count">', "</span></span>"];
|
|
1861
|
+
const $0ef1681699140f1a$var$gap_px = 5;
|
|
1862
|
+
const $0ef1681699140f1a$var$max_columns = 3;
|
|
1847
1863
|
const $0ef1681699140f1a$export$414f6a19d38e655c = ({
|
|
1848
1864
|
filter_: filter_,
|
|
1849
1865
|
selected_filters_: [get_selected_filters, set_selected_filters]
|
|
@@ -1866,23 +1882,139 @@ const $0ef1681699140f1a$export$414f6a19d38e655c = ({
|
|
|
1866
1882
|
count_: meta.counts?.[index]
|
|
1867
1883
|
}));
|
|
1868
1884
|
});
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1885
|
+
const [sizes_set, set_sizes_set] = $5vyXB$solidjs.createSignal(new Set(), {
|
|
1886
|
+
equals: false
|
|
1887
|
+
});
|
|
1888
|
+
const [cols_at_size, set_cols_at_size] = $5vyXB$solidjs.createSignal([[1, "0px", ""]]);
|
|
1889
|
+
const [container, set_container] = $5vyXB$solidjs.createSignal();
|
|
1890
|
+
const container_width_accessor = $5vyXB$solidjs.createMemo(() => {
|
|
1891
|
+
const element = container();
|
|
1892
|
+
if (!element) return;
|
|
1893
|
+
return $e5f442fb78c98741$export$9f191182275e9ef(element);
|
|
1894
|
+
});
|
|
1895
|
+
const [shadow_children, set_shadow_children] = $5vyXB$solidjs.createSignal(new Set(), {
|
|
1896
|
+
equals: false
|
|
1897
|
+
});
|
|
1898
|
+
const shadow_grid = $5vyXB$solidjsweb.ssr($0ef1681699140f1a$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape([...shadow_children()])); // for getting the smallest possible sizes of all the items
|
|
1899
|
+
$5vyXB$solidjs.createEffect(() => {
|
|
1900
|
+
const container_width = container_width_accessor()?.();
|
|
1901
|
+
if (container_width == undefined) return;
|
|
1902
|
+
$0ef1681699140f1a$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
|
|
1903
|
+
});
|
|
1904
|
+
return [shadow_grid, $5vyXB$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), {
|
|
1905
|
+
get cols_at_size() {
|
|
1906
|
+
return cols_at_size();
|
|
1872
1907
|
},
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1908
|
+
grid_spacing: $0ef1681699140f1a$var$gap_px + "px",
|
|
1909
|
+
rows: "all",
|
|
1910
|
+
layout: "grid",
|
|
1911
|
+
element_attributes: {
|
|
1912
|
+
class: "checkbox-grid",
|
|
1913
|
+
ref: el => set_container(el)
|
|
1914
|
+
},
|
|
1915
|
+
get children() {
|
|
1916
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Index), {
|
|
1917
|
+
get each() {
|
|
1918
|
+
return buttons();
|
|
1878
1919
|
},
|
|
1879
|
-
|
|
1880
|
-
|
|
1920
|
+
children: value => {
|
|
1921
|
+
const is_selected = $5vyXB$solidjs.createMemo(() => existing_filter()?.data?.includes(value().value_));
|
|
1922
|
+
const MakeButton = attributes => $5vyXB$solidjsweb.ssrElement("button", () => ({
|
|
1923
|
+
...attributes,
|
|
1924
|
+
"disabled": value().count_ === 0 && !is_selected(),
|
|
1925
|
+
"classList": {
|
|
1926
|
+
minor: !is_selected(),
|
|
1927
|
+
major: is_selected(),
|
|
1928
|
+
"major-minor-transition": true
|
|
1929
|
+
}
|
|
1930
|
+
}), () => ["<!--#-->", $5vyXB$solidjsweb.escape(value().value_), "<!--/-->", "<!--#-->", $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
1931
|
+
get when() {
|
|
1932
|
+
return value().count_ != undefined;
|
|
1933
|
+
},
|
|
1934
|
+
get children() {
|
|
1935
|
+
return $5vyXB$solidjsweb.ssr($0ef1681699140f1a$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(value().count_));
|
|
1936
|
+
}
|
|
1937
|
+
})), "<!--/-->"], true);
|
|
1938
|
+
const invisible_size_button = $5vyXB$solidjsweb.createComponent(MakeButton, {});
|
|
1939
|
+
const smallest_possible_size = $e5f442fb78c98741$export$9f191182275e9ef(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
|
|
1940
|
+
const sizes_value = $5vyXB$solidjs.untrack(sizes_set);
|
|
1941
|
+
const shadow_children_value = $5vyXB$solidjs.untrack(shadow_children);
|
|
1942
|
+
sizes_value.add(smallest_possible_size);
|
|
1943
|
+
set_sizes_set(sizes_value);
|
|
1944
|
+
shadow_children_value.add(invisible_size_button);
|
|
1945
|
+
set_shadow_children(shadow_children_value);
|
|
1946
|
+
$5vyXB$solidjs.onCleanup(() => {
|
|
1947
|
+
const sizes_value = $5vyXB$solidjs.untrack(sizes_set);
|
|
1948
|
+
const shadow_children_value = $5vyXB$solidjs.untrack(shadow_children);
|
|
1949
|
+
sizes_value.delete(smallest_possible_size);
|
|
1950
|
+
set_sizes_set(sizes_value);
|
|
1951
|
+
shadow_children_value.delete(invisible_size_button);
|
|
1952
|
+
set_shadow_children(shadow_children_value);
|
|
1953
|
+
});
|
|
1954
|
+
// The actual button that will be visible
|
|
1955
|
+
return $5vyXB$solidjsweb.createComponent(MakeButton, {});
|
|
1881
1956
|
}
|
|
1882
|
-
})
|
|
1957
|
+
});
|
|
1883
1958
|
}
|
|
1884
|
-
})
|
|
1959
|
+
})];
|
|
1885
1960
|
};
|
|
1961
|
+
/**
|
|
1962
|
+
* Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
|
|
1963
|
+
*/
|
|
1964
|
+
function $0ef1681699140f1a$var$adjust_sizes(container_width, sizes, set_cols_at_size) {
|
|
1965
|
+
let current_row_index = 0;
|
|
1966
|
+
let current_row_items = [];
|
|
1967
|
+
const column_to_row_result = {};
|
|
1968
|
+
const check_would_fit_evenly = (min_size_of_item, at_number_of_columnns) => {
|
|
1969
|
+
const would_have_even_size = container_width / at_number_of_columnns - (at_number_of_columnns * 2 - 2) * ($0ef1681699140f1a$var$gap_px / 2) / at_number_of_columnns; // What size would our element have (without gaps), given that now every column had the same width (equation from Layout.tsx)
|
|
1970
|
+
return would_have_even_size >= min_size_of_item; // would this item still fit if we added another column? (probably what the caller has done with at_number_of_columns), given that every item has the same size
|
|
1971
|
+
};
|
|
1972
|
+
|
|
1973
|
+
for (const size_item of sizes) {
|
|
1974
|
+
const size = size_item();
|
|
1975
|
+
if (size == undefined) return; // Only do stuff if we know all the sizes
|
|
1976
|
+
const current_row_length = current_row_items.length;
|
|
1977
|
+
const can_add_another_column_initial_val = current_row_length < $0ef1681699140f1a$var$max_columns; // allow max 4 items per row
|
|
1978
|
+
let can_add_another_column = can_add_another_column_initial_val;
|
|
1979
|
+
if (can_add_another_column)
|
|
1980
|
+
// can we actually? Since adding another column changes the size of all elements in the row we need to check all of them
|
|
1981
|
+
for (let i = -1; i < current_row_length; i++) {
|
|
1982
|
+
// -1 is for the new item we're adding and every item is guaranteed to exist
|
|
1983
|
+
const size_to_check = current_row_items[i] ?? size;
|
|
1984
|
+
const would_have_columns = current_row_length + 1; // if we added another column
|
|
1985
|
+
const would_fit_evenly = check_would_fit_evenly(size_to_check, would_have_columns); // see comments in check_would_fit_evenly
|
|
1986
|
+
if (!would_fit_evenly) {
|
|
1987
|
+
can_add_another_column = false;
|
|
1988
|
+
break;
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
if (can_add_another_column) current_row_items.push(size);else {
|
|
1992
|
+
column_to_row_result[++current_row_index] = current_row_length || 1; // overrides is indexed by 1 it seems, therefore ++curent_row_index
|
|
1993
|
+
current_row_items = [size]; // save current item for next row
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
const items_left_to_add = current_row_items.length;
|
|
1998
|
+
if (items_left_to_add) {
|
|
1999
|
+
let num_columns = 1; // We want to have as close to max_columns as possible in the last row
|
|
2000
|
+
let fits = true;
|
|
2001
|
+
do
|
|
2002
|
+
// Check if more columns would fit
|
|
2003
|
+
for (let i = 0; i < items_left_to_add; i++) {
|
|
2004
|
+
const item = current_row_items[i];
|
|
2005
|
+
const would_fit_evenly = check_would_fit_evenly(item, num_columns + 1);
|
|
2006
|
+
if (!would_fit_evenly) {
|
|
2007
|
+
fits = false;
|
|
2008
|
+
break;
|
|
2009
|
+
}
|
|
2010
|
+
} while (fits && ++num_columns < $0ef1681699140f1a$var$max_columns);
|
|
2011
|
+
column_to_row_result[++current_row_index] = num_columns; // Add last row that's left after loop finished
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
set_cols_at_size([[1, "0px", "", null, {
|
|
2015
|
+
overrides: column_to_row_result
|
|
2016
|
+
}]]);
|
|
2017
|
+
}
|
|
1886
2018
|
function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
|
|
1887
2019
|
const signal = $5vyXB$solidjs.createSignal(false);
|
|
1888
2020
|
$5vyXB$solidjs.onCleanup($5vyXB$depictaiutilishared.javascript_media_query(media_query, ({
|
|
@@ -1927,7 +2059,7 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
|
|
|
1927
2059
|
const hex_color = $5vyXB$solidjs.createMemo(() => checkbox().value_.split(";")?.[1] || "");
|
|
1928
2060
|
const rgb_color = $5vyXB$solidjs.createMemo(() => $5vyXB$depictaiutilishared.hex_to_rgb(hex_color()));
|
|
1929
2061
|
const black_contrast_better = $5vyXB$solidjs.createMemo(() => rgb_color() ? $b51a2b8b9355e66c$var$does_black_contrast_better(rgb_color()) : false);
|
|
1930
|
-
const input_row = $5vyXB$solidjsweb.createComponent((0, $
|
|
2062
|
+
const input_row = $5vyXB$solidjsweb.createComponent((0, $1c63082b2da848ad$export$48513f6b9f8ce62d), {
|
|
1931
2063
|
get value_() {
|
|
1932
2064
|
return checkbox().value_;
|
|
1933
2065
|
},
|
package/server/latest/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ 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.0.2";
|
|
11
11
|
export type SDKGridSpacing = string | {
|
|
12
12
|
horizontal: string;
|
|
13
13
|
vertical: string;
|