@depict-ai/ui 2.0.5 → 2.0.7
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 +165 -141
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +165 -141
- package/latest/index.cjs +140 -113
- package/latest/index.d.ts +1 -1
- package/latest/index.js +140 -113
- package/package.json +2 -2
- package/server/ES10/index.cjs +109 -100
- package/server/ES10/index.d.ts +1 -1
- package/server/ES10/index.js +109 -100
- package/server/latest/index.cjs +89 -77
- package/server/latest/index.d.ts +1 -1
- package/server/latest/index.js +89 -77
package/server/latest/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ssr as $i7OB2$ssr, ssrHydrationKey as $i7OB2$ssrHydrationKey, escape as
|
|
|
5
5
|
/*! Depict.ai search and product listing SDK */
|
|
6
6
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
7
7
|
register_es_version("ui", "latest");
|
|
8
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "2.0.
|
|
8
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "2.0.7";
|
|
9
9
|
|
|
10
10
|
/** @jsxImportSource solid-js */
|
|
11
11
|
|
|
@@ -56,27 +56,6 @@ const $b5cccc8ee7d24677$export$6daf8749b65a1b77 = cols_at_size => {
|
|
|
56
56
|
});
|
|
57
57
|
return $b5cccc8ee7d24677$var$transform_elements(sorted_cols_at_size);
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
|
|
62
|
-
*/
|
|
63
|
-
function $1848f7cca286fbab$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
|
|
64
|
-
if (!sdk_cols_at_size.length) return sdk_cols_at_size;
|
|
65
|
-
const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
|
|
66
|
-
const [[, smallest_max_width]] = sorted_sizes;
|
|
67
|
-
if (smallest_max_width > min_width_for_more_than_one_column)
|
|
68
|
-
// If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
|
|
69
|
-
return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
|
|
70
|
-
const to_delete = [];
|
|
71
|
-
for (let i = 0; i < sorted_sizes.length; i++) {
|
|
72
|
-
const [, max_width] = sorted_sizes[i];
|
|
73
|
-
if (max_width > min_width_for_more_than_one_column) continue;
|
|
74
|
-
to_delete.push(i);
|
|
75
|
-
}
|
|
76
|
-
while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
|
|
77
|
-
sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
|
|
78
|
-
return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
|
|
79
|
-
}
|
|
80
59
|
function $a458486f22b22f63$export$a2cc176055f8f08() {
|
|
81
60
|
const text = "Please try setting `colsAtSize` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
|
|
82
61
|
return (0, $i7OB2$isServer) ? {
|
|
@@ -542,7 +521,7 @@ function $ee116da074deb002$export$9574e176201e5e8d(props) {
|
|
|
542
521
|
market_: () => props.market,
|
|
543
522
|
merchant_: () => props.merchant,
|
|
544
523
|
layout_options_: $i7OB2$createMemo(() => ({
|
|
545
|
-
cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77(
|
|
524
|
+
cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77(props.cols_at_size),
|
|
546
525
|
...grid_spacing_override()
|
|
547
526
|
}))
|
|
548
527
|
})));
|
|
@@ -640,7 +619,7 @@ function $9ea5383493360761$export$9756467d34d91cdb(props) {
|
|
|
640
619
|
market_: () => props.market,
|
|
641
620
|
merchant_: () => props.merchant,
|
|
642
621
|
layout_options_: $i7OB2$createMemo(() => ({
|
|
643
|
-
cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77(
|
|
622
|
+
cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77(props.cols_at_size),
|
|
644
623
|
...grid_spacing_override()
|
|
645
624
|
}))
|
|
646
625
|
})));
|
|
@@ -1195,9 +1174,9 @@ function $eb8d9bf3b5700c26$export$430444115f70a734({
|
|
|
1195
1174
|
}
|
|
1196
1175
|
})));
|
|
1197
1176
|
}
|
|
1198
|
-
const $a6b08770e164eced$var$_tmpl$ = ["<div", ' class="
|
|
1177
|
+
const $a6b08770e164eced$var$_tmpl$ = ["<div", ' class="', '"><div class="input-group"><div class="field"><input', ' type="number"', '></div><div class="separator">-</div><div class="field"><input', ' type="number"', "></div></div><!--#-->", '<!--/--><div class="value-text"><span class="min"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", '<!--/--></span><span class="max"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span></div></div>"],
|
|
1199
1178
|
$a6b08770e164eced$var$_tmpl$2 = ["<div", ' class="slider"><div class="progress" style="', '"></div></div>'],
|
|
1200
|
-
$a6b08770e164eced$var$_tmpl$3 = ["<div", ' class="range-group"><input type="range"', ' step="any"><input', ' type="range"', ' step="any"></div>'];
|
|
1179
|
+
$a6b08770e164eced$var$_tmpl$3 = ["<div", ' class="range-group"><input', ' type="range"', ' step="any"><input', ' type="range"', ' step="any"></div>'];
|
|
1201
1180
|
function $a6b08770e164eced$export$e0d834a0ad870cda({
|
|
1202
1181
|
filter_: filter_,
|
|
1203
1182
|
selected_filters_: selected_filters_,
|
|
@@ -1270,11 +1249,13 @@ function $a6b08770e164eced$var$RangeSelector({
|
|
|
1270
1249
|
const [get_current_range] = current_range_;
|
|
1271
1250
|
const pre_price = $i7OB2$createMemo(() => price_formatting_().pre_);
|
|
1272
1251
|
const post_price = $i7OB2$createMemo(() => price_formatting_().post_);
|
|
1273
|
-
|
|
1252
|
+
const should_be_disabled_ = $i7OB2$createMemo(() => Math.abs(min_() - max_()) < 2);
|
|
1253
|
+
return $i7OB2$ssr($a6b08770e164eced$var$_tmpl$, $i7OB2$ssrHydrationKey(), `range ${min_() === max_() ? "disabled" : ""}`, $i7OB2$ssrAttribute("disabled", should_be_disabled_(), true), $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $i7OB2$ssrAttribute("min", $i7OB2$escape(min_(), true), false) + $i7OB2$ssrAttribute("max", $i7OB2$escape(max_(), true), false) + $i7OB2$ssrAttribute("value", $i7OB2$escape(get_current_range()[0], true), false), $i7OB2$ssrAttribute("disabled", should_be_disabled_(), true) + $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.range_filter_high_point_aria_label_(), true), false), $i7OB2$ssrAttribute("min", $i7OB2$escape(min_(), true), false) + $i7OB2$ssrAttribute("max", $i7OB2$escape(max_(), true), false) + $i7OB2$ssrAttribute("value", $i7OB2$escape(get_current_range()[1], true), false), $i7OB2$escape($i7OB2$createComponent($a6b08770e164eced$var$ExponentialSlider, {
|
|
1274
1254
|
max_: max_,
|
|
1275
1255
|
min_: min_,
|
|
1276
1256
|
current_range_: current_range_,
|
|
1277
|
-
i18n_: i18n_
|
|
1257
|
+
i18n_: i18n_,
|
|
1258
|
+
should_be_disabled_: should_be_disabled_
|
|
1278
1259
|
})), $i7OB2$escape(pre_price()), $i7OB2$escape($i7OB2$createComponent((0, $8c0f86cb3e266eeb$export$a71e92cfbb498adc), {
|
|
1279
1260
|
get price_() {
|
|
1280
1261
|
return min_();
|
|
@@ -1295,13 +1276,13 @@ function $a6b08770e164eced$var$ExponentialSlider({
|
|
|
1295
1276
|
current_range_: current_range_,
|
|
1296
1277
|
min_: min_,
|
|
1297
1278
|
i18n_: i18n_,
|
|
1298
|
-
max_: max_
|
|
1279
|
+
max_: max_,
|
|
1280
|
+
should_be_disabled_: should_be_disabled_
|
|
1299
1281
|
}) {
|
|
1300
1282
|
// inspired by https://observablehq.com/@mbostock/nonlinear-slider
|
|
1301
1283
|
const transform_linear_to_nonlinear = ([smaller, larger]) => [Math.sqrt(smaller), Math.sqrt(larger)];
|
|
1302
1284
|
const [read_current_range, write_current_range] = current_range_;
|
|
1303
|
-
const
|
|
1304
|
-
const [read_modified_range, write_modified_range] = modified_range;
|
|
1285
|
+
const modified_range_accessor = $i7OB2$createMemo(() => transform_linear_to_nonlinear(read_current_range()));
|
|
1305
1286
|
const modified_max = $i7OB2$createMemo(() => Math.sqrt(max_()));
|
|
1306
1287
|
const modified_min = $i7OB2$createMemo(() => Math.sqrt(min_()));
|
|
1307
1288
|
const offset_value_calculator_ = (value, how_many) => {
|
|
@@ -1309,23 +1290,28 @@ function $a6b08770e164eced$var$ExponentialSlider({
|
|
|
1309
1290
|
const changed = number_in_linear + how_many;
|
|
1310
1291
|
return Math.sqrt(changed);
|
|
1311
1292
|
};
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
const
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1293
|
+
const convert_back = (smaller, larger) => [Math.round(smaller * smaller), Math.round(larger * larger)];
|
|
1294
|
+
const modified_range_setter = new_range_or_function => {
|
|
1295
|
+
const old_range = $i7OB2$untrack(modified_range_accessor);
|
|
1296
|
+
const new_range = typeof new_range_or_function === "function" ? new_range_or_function(old_range) : new_range_or_function;
|
|
1297
|
+
const [smaller, larger] = new_range;
|
|
1298
|
+
const [old_smaller, old_larger] = old_range;
|
|
1299
|
+
const new_range_converted = convert_back(smaller, larger);
|
|
1300
|
+
const old_range_converted = convert_back(old_smaller, old_larger);
|
|
1301
|
+
if (new_range_converted[0] === old_range_converted[0] && new_range_converted[1] === old_range_converted[1])
|
|
1302
|
+
// If the new value gets identical rounding errors to the old value when being converted back, don't write it to the signal since it would cause an infinite loop
|
|
1303
|
+
return new_range;
|
|
1304
|
+
write_current_range(new_range_converted);
|
|
1305
|
+
return new_range;
|
|
1306
|
+
};
|
|
1323
1307
|
return $a6b08770e164eced$var$LinearSlider({
|
|
1324
|
-
current_range_:
|
|
1308
|
+
current_range_: [modified_range_accessor, modified_range_setter],
|
|
1309
|
+
// "Lie" to the actual slider so we don't have to implement exponential handling in there
|
|
1325
1310
|
min_: modified_min,
|
|
1326
1311
|
max_: modified_max,
|
|
1327
1312
|
offset_value_calculator_: offset_value_calculator_,
|
|
1328
|
-
i18n_: i18n_
|
|
1313
|
+
i18n_: i18n_,
|
|
1314
|
+
should_be_disabled_: should_be_disabled_
|
|
1329
1315
|
});
|
|
1330
1316
|
}
|
|
1331
1317
|
function $a6b08770e164eced$var$LinearSlider({
|
|
@@ -1333,7 +1319,8 @@ function $a6b08770e164eced$var$LinearSlider({
|
|
|
1333
1319
|
min_: min_,
|
|
1334
1320
|
current_range_: current_range_,
|
|
1335
1321
|
offset_value_calculator_: offset_value_calculator_,
|
|
1336
|
-
i18n_: i18n_
|
|
1322
|
+
i18n_: i18n_,
|
|
1323
|
+
should_be_disabled_: should_be_disabled_
|
|
1337
1324
|
}) {
|
|
1338
1325
|
let range_input_1;
|
|
1339
1326
|
let range_input_2;
|
|
@@ -1343,6 +1330,7 @@ function $a6b08770e164eced$var$LinearSlider({
|
|
|
1343
1330
|
const min = min_();
|
|
1344
1331
|
const span = max_() - min;
|
|
1345
1332
|
const [start, end] = get_current_range();
|
|
1333
|
+
if (should_be_disabled_()) return `left:50%;right:50%`;
|
|
1346
1334
|
return `left:${(start - min) / span * 100}%;right:${100 - (end - min) / span * 100}%`;
|
|
1347
1335
|
});
|
|
1348
1336
|
const set_value = (el, index) => {
|
|
@@ -1356,13 +1344,13 @@ function $a6b08770e164eced$var$LinearSlider({
|
|
|
1356
1344
|
el.value = get_current_range()[index];
|
|
1357
1345
|
});
|
|
1358
1346
|
};
|
|
1359
|
-
return [$i7OB2$ssr($a6b08770e164eced$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$ssrStyle(progress_styling())), $i7OB2$ssr($a6b08770e164eced$var$_tmpl$3, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $i7OB2$ssrAttribute("min", $i7OB2$escape(min_(), true), false) + $i7OB2$ssrAttribute("max", $i7OB2$escape(max_(), true), false) + $i7OB2$ssrAttribute("value", $i7OB2$escape($i7OB2$createMemo(() => {
|
|
1347
|
+
return [$i7OB2$ssr($a6b08770e164eced$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$ssrStyle(progress_styling())), $i7OB2$ssr($a6b08770e164eced$var$_tmpl$3, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("disabled", should_be_disabled_(), true), $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.range_filter_low_point_aria_label_(), true), false) + $i7OB2$ssrAttribute("min", $i7OB2$escape(min_(), true), false) + $i7OB2$ssrAttribute("max", $i7OB2$escape(max_(), true), false) + $i7OB2$ssrAttribute("value", $i7OB2$escape($i7OB2$createMemo(() => {
|
|
1360
1348
|
min_();
|
|
1361
1349
|
max_();
|
|
1362
1350
|
return get_current_range()[0];
|
|
1363
1351
|
}, undefined, {
|
|
1364
1352
|
equals: false
|
|
1365
|
-
})(), true), false), $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.range_filter_high_point_aria_label_(), true), false), $i7OB2$ssrAttribute("min", $i7OB2$escape(min_(), true), false) + $i7OB2$ssrAttribute("max", $i7OB2$escape(max_(), true), false))];
|
|
1353
|
+
})(), true), false), $i7OB2$ssrAttribute("disabled", should_be_disabled_(), true) + $i7OB2$ssrAttribute("aria-label", $i7OB2$escape(i18n_.range_filter_high_point_aria_label_(), true), false), $i7OB2$ssrAttribute("min", $i7OB2$escape(min_(), true), false) + $i7OB2$ssrAttribute("max", $i7OB2$escape(max_(), true), false))];
|
|
1366
1354
|
}
|
|
1367
1355
|
function $a6b08770e164eced$var$set_range_with_sanitation(min_, max_, current_range_signal, index, target_el, get_offset_value = (value, how_many) => value + how_many) {
|
|
1368
1356
|
let value_as_number = +target_el.value;
|
|
@@ -1611,37 +1599,40 @@ function $1c8cac76cb67e9af$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
1611
1599
|
return has_expandable();
|
|
1612
1600
|
},
|
|
1613
1601
|
get children() {
|
|
1614
|
-
return
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1602
|
+
return (() => {
|
|
1603
|
+
const is_open = $i7OB2$createMemo(() => {
|
|
1604
|
+
const v = value();
|
|
1605
|
+
if (!v)
|
|
1606
|
+
// only to prevent cleanup errors
|
|
1607
|
+
return $i7OB2$createSignal(false);
|
|
1608
|
+
const {
|
|
1609
|
+
is_expanded_: {
|
|
1610
|
+
ui_should_show_expanded_: ui_should_show_expanded_,
|
|
1611
|
+
set_user_expanded_: set_user_expanded_
|
|
1623
1612
|
}
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1613
|
+
} = v;
|
|
1614
|
+
return [ui_should_show_expanded_, set_user_expanded_];
|
|
1615
|
+
});
|
|
1616
|
+
return $i7OB2$createComponent((0, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d), {
|
|
1617
|
+
get details_() {
|
|
1618
|
+
return $i7OB2$ssr($1c8cac76cb67e9af$var$_tmpl$3, $i7OB2$ssrHydrationKey());
|
|
1619
|
+
},
|
|
1620
|
+
get summary_() {
|
|
1621
|
+
return $i7OB2$ssr($1c8cac76cb67e9af$var$_tmpl$4, $i7OB2$ssrHydrationKey(), `count ${value()?.count_ === 0 ? "count-0" : ""}`, $i7OB2$escape(value()?.count_), $i7OB2$escape($i7OB2$createComponent((0, $0b6bc2f8309efa8a$export$e5c2828934226505), {
|
|
1622
|
+
i18n_: i18n_,
|
|
1623
|
+
get expanded_() {
|
|
1624
|
+
return $i7OB2$createMemo(() => value()?.is_expanded_?.ui_should_show_expanded_?.() ?? false);
|
|
1636
1625
|
}
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1626
|
+
})));
|
|
1627
|
+
},
|
|
1628
|
+
get is_open_() {
|
|
1629
|
+
return is_open();
|
|
1630
|
+
},
|
|
1631
|
+
get children() {
|
|
1632
|
+
return $1c8cac76cb67e9af$var$render_stuff($i7OB2$createMemo(() => value()?.children_ || {}), existing_filter, i18n_);
|
|
1633
|
+
}
|
|
1634
|
+
});
|
|
1635
|
+
})();
|
|
1645
1636
|
}
|
|
1646
1637
|
})));
|
|
1647
1638
|
})();
|
|
@@ -1704,7 +1695,7 @@ function $1c8cac76cb67e9af$var$create_updating_signal({
|
|
|
1704
1695
|
// wait for the children to have populated and us to have received the correct value_ and name_ values
|
|
1705
1696
|
let updating_blocked = false;
|
|
1706
1697
|
const index_of_us_in_selected_filter = existing_filter_?.data?.findIndex?.(el => el.length === self_.value_.length && el.every((sub_el, index) => self_.value_[index] === sub_el));
|
|
1707
|
-
signal_.push(...$i7OB2$createSignal(index_of_us_in_selected_filter >= 0
|
|
1698
|
+
signal_.push(...$i7OB2$createSignal(index_of_us_in_selected_filter >= 0));
|
|
1708
1699
|
const [read_checked, write_checked] = signal_;
|
|
1709
1700
|
const child_objects = Object.values(self_.children_);
|
|
1710
1701
|
const get_child_object_values = child_objects.map(({
|
|
@@ -8124,6 +8115,27 @@ function $4ca91518c9a35379$export$828dcdd425fd3231(aligner) {
|
|
|
8124
8115
|
cleanup: cleanup
|
|
8125
8116
|
};
|
|
8126
8117
|
}
|
|
8118
|
+
|
|
8119
|
+
/**
|
|
8120
|
+
* Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
|
|
8121
|
+
*/
|
|
8122
|
+
function $1848f7cca286fbab$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
|
|
8123
|
+
if (!sdk_cols_at_size.length) return sdk_cols_at_size;
|
|
8124
|
+
const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
|
|
8125
|
+
const [[, smallest_max_width]] = sorted_sizes;
|
|
8126
|
+
if (smallest_max_width > min_width_for_more_than_one_column)
|
|
8127
|
+
// If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
|
|
8128
|
+
return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
|
|
8129
|
+
const to_delete = [];
|
|
8130
|
+
for (let i = 0; i < sorted_sizes.length; i++) {
|
|
8131
|
+
const [, max_width] = sorted_sizes[i];
|
|
8132
|
+
if (max_width > min_width_for_more_than_one_column) continue;
|
|
8133
|
+
to_delete.push(i);
|
|
8134
|
+
}
|
|
8135
|
+
while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
|
|
8136
|
+
sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
|
|
8137
|
+
return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
|
|
8138
|
+
}
|
|
8127
8139
|
const $806c97b931758897$var$_tmpl$ = ["<div", ' class="depict plp search">', "</div>"];
|
|
8128
8140
|
// We just pass page_url_creator to DepictAPI when we instantiate it, so don't allow it to be specified if api is already specified
|
|
8129
8141
|
/**
|