@depict-ai/ui 2.0.4 → 2.0.6
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 +139 -109
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +139 -109
- package/latest/index.cjs +125 -92
- package/latest/index.d.ts +1 -1
- package/latest/index.js +125 -92
- package/package.json +2 -2
- package/server/ES10/index.cjs +82 -67
- package/server/ES10/index.d.ts +1 -1
- package/server/ES10/index.js +82 -67
- package/server/latest/index.cjs +73 -55
- package/server/latest/index.d.ts +1 -1
- package/server/latest/index.js +73 -55
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.6";
|
|
9
9
|
|
|
10
10
|
/** @jsxImportSource solid-js */
|
|
11
11
|
|
|
@@ -1195,14 +1195,17 @@ function $eb8d9bf3b5700c26$export$430444115f70a734({
|
|
|
1195
1195
|
}
|
|
1196
1196
|
})));
|
|
1197
1197
|
}
|
|
1198
|
-
const $a6b08770e164eced$var$_tmpl$ = ["<div", ' class="
|
|
1198
|
+
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
1199
|
$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>'];
|
|
1200
|
+
$a6b08770e164eced$var$_tmpl$3 = ["<div", ' class="range-group"><input', ' type="range"', ' step="any"><input', ' type="range"', ' step="any"></div>'];
|
|
1201
1201
|
function $a6b08770e164eced$export$e0d834a0ad870cda({
|
|
1202
1202
|
filter_: filter_,
|
|
1203
1203
|
selected_filters_: selected_filters_,
|
|
1204
1204
|
i18n_: i18n_
|
|
1205
1205
|
}) {
|
|
1206
|
+
// If you ever attempt to implement that one can drag one range "knob" over the other like on prisjakt, see https://gitlab.com/depict-ai/depict.ai/-/merge_requests/8458/diffs?commit_id=c52dbdd15ca073489bee138b15d27bb6bf2992df
|
|
1207
|
+
// The issue with it is that one wants to discard the changes to the lower value as soon as the lower value has become the upper value when dragging the initially lower knob over the initially upper knob
|
|
1208
|
+
// But we can't reliably know when we've started dragging/changing the value (or at least I gave up at that point for now)
|
|
1206
1209
|
const current_range = $i7OB2$createSignal($i7OB2$untrack(() => filter_().data));
|
|
1207
1210
|
const selected_filter = $i7OB2$createMemo(() => selected_filters_[0]().find(({
|
|
1208
1211
|
field: checking_field,
|
|
@@ -1267,11 +1270,13 @@ function $a6b08770e164eced$var$RangeSelector({
|
|
|
1267
1270
|
const [get_current_range] = current_range_;
|
|
1268
1271
|
const pre_price = $i7OB2$createMemo(() => price_formatting_().pre_);
|
|
1269
1272
|
const post_price = $i7OB2$createMemo(() => price_formatting_().post_);
|
|
1270
|
-
|
|
1273
|
+
const should_be_disabled_ = $i7OB2$createMemo(() => Math.abs(min_() - max_()) < 2);
|
|
1274
|
+
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, {
|
|
1271
1275
|
max_: max_,
|
|
1272
1276
|
min_: min_,
|
|
1273
1277
|
current_range_: current_range_,
|
|
1274
|
-
i18n_: i18n_
|
|
1278
|
+
i18n_: i18n_,
|
|
1279
|
+
should_be_disabled_: should_be_disabled_
|
|
1275
1280
|
})), $i7OB2$escape(pre_price()), $i7OB2$escape($i7OB2$createComponent((0, $8c0f86cb3e266eeb$export$a71e92cfbb498adc), {
|
|
1276
1281
|
get price_() {
|
|
1277
1282
|
return min_();
|
|
@@ -1292,13 +1297,13 @@ function $a6b08770e164eced$var$ExponentialSlider({
|
|
|
1292
1297
|
current_range_: current_range_,
|
|
1293
1298
|
min_: min_,
|
|
1294
1299
|
i18n_: i18n_,
|
|
1295
|
-
max_: max_
|
|
1300
|
+
max_: max_,
|
|
1301
|
+
should_be_disabled_: should_be_disabled_
|
|
1296
1302
|
}) {
|
|
1297
1303
|
// inspired by https://observablehq.com/@mbostock/nonlinear-slider
|
|
1298
1304
|
const transform_linear_to_nonlinear = ([smaller, larger]) => [Math.sqrt(smaller), Math.sqrt(larger)];
|
|
1299
1305
|
const [read_current_range, write_current_range] = current_range_;
|
|
1300
|
-
const
|
|
1301
|
-
const [read_modified_range, write_modified_range] = modified_range;
|
|
1306
|
+
const modified_range_accessor = $i7OB2$createMemo(() => transform_linear_to_nonlinear(read_current_range()));
|
|
1302
1307
|
const modified_max = $i7OB2$createMemo(() => Math.sqrt(max_()));
|
|
1303
1308
|
const modified_min = $i7OB2$createMemo(() => Math.sqrt(min_()));
|
|
1304
1309
|
const offset_value_calculator_ = (value, how_many) => {
|
|
@@ -1306,23 +1311,28 @@ function $a6b08770e164eced$var$ExponentialSlider({
|
|
|
1306
1311
|
const changed = number_in_linear + how_many;
|
|
1307
1312
|
return Math.sqrt(changed);
|
|
1308
1313
|
};
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
const
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1314
|
+
const convert_back = (smaller, larger) => [Math.round(smaller * smaller), Math.round(larger * larger)];
|
|
1315
|
+
const modified_range_setter = new_range_or_function => {
|
|
1316
|
+
const old_range = $i7OB2$untrack(modified_range_accessor);
|
|
1317
|
+
const new_range = typeof new_range_or_function === "function" ? new_range_or_function(old_range) : new_range_or_function;
|
|
1318
|
+
const [smaller, larger] = new_range;
|
|
1319
|
+
const [old_smaller, old_larger] = old_range;
|
|
1320
|
+
const new_range_converted = convert_back(smaller, larger);
|
|
1321
|
+
const old_range_converted = convert_back(old_smaller, old_larger);
|
|
1322
|
+
if (new_range_converted[0] === old_range_converted[0] && new_range_converted[1] === old_range_converted[1])
|
|
1323
|
+
// 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
|
|
1324
|
+
return new_range;
|
|
1325
|
+
write_current_range(new_range_converted);
|
|
1326
|
+
return new_range;
|
|
1327
|
+
};
|
|
1320
1328
|
return $a6b08770e164eced$var$LinearSlider({
|
|
1321
|
-
current_range_:
|
|
1329
|
+
current_range_: [modified_range_accessor, modified_range_setter],
|
|
1330
|
+
// "Lie" to the actual slider so we don't have to implement exponential handling in there
|
|
1322
1331
|
min_: modified_min,
|
|
1323
1332
|
max_: modified_max,
|
|
1324
1333
|
offset_value_calculator_: offset_value_calculator_,
|
|
1325
|
-
i18n_: i18n_
|
|
1334
|
+
i18n_: i18n_,
|
|
1335
|
+
should_be_disabled_: should_be_disabled_
|
|
1326
1336
|
});
|
|
1327
1337
|
}
|
|
1328
1338
|
function $a6b08770e164eced$var$LinearSlider({
|
|
@@ -1330,14 +1340,19 @@ function $a6b08770e164eced$var$LinearSlider({
|
|
|
1330
1340
|
min_: min_,
|
|
1331
1341
|
current_range_: current_range_,
|
|
1332
1342
|
offset_value_calculator_: offset_value_calculator_,
|
|
1333
|
-
i18n_: i18n_
|
|
1343
|
+
i18n_: i18n_,
|
|
1344
|
+
should_be_disabled_: should_be_disabled_
|
|
1334
1345
|
}) {
|
|
1335
1346
|
let range_input_1;
|
|
1336
1347
|
let range_input_2;
|
|
1337
1348
|
let clickable_slider;
|
|
1338
1349
|
const [get_current_range, set_current_range] = current_range_;
|
|
1339
1350
|
const progress_styling = $i7OB2$createMemo(() => {
|
|
1340
|
-
|
|
1351
|
+
const min = min_();
|
|
1352
|
+
const span = max_() - min;
|
|
1353
|
+
const [start, end] = get_current_range();
|
|
1354
|
+
if (should_be_disabled_()) return `left:50%;right:50%`;
|
|
1355
|
+
return `left:${(start - min) / span * 100}%;right:${100 - (end - min) / span * 100}%`;
|
|
1341
1356
|
});
|
|
1342
1357
|
const set_value = (el, index) => {
|
|
1343
1358
|
// initially I set the value on the elements by just having value={get_current_range()[0]}
|
|
@@ -1350,13 +1365,13 @@ function $a6b08770e164eced$var$LinearSlider({
|
|
|
1350
1365
|
el.value = get_current_range()[index];
|
|
1351
1366
|
});
|
|
1352
1367
|
};
|
|
1353
|
-
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(() => {
|
|
1368
|
+
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(() => {
|
|
1354
1369
|
min_();
|
|
1355
1370
|
max_();
|
|
1356
1371
|
return get_current_range()[0];
|
|
1357
1372
|
}, undefined, {
|
|
1358
1373
|
equals: false
|
|
1359
|
-
})(), 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))];
|
|
1374
|
+
})(), 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))];
|
|
1360
1375
|
}
|
|
1361
1376
|
function $a6b08770e164eced$var$set_range_with_sanitation(min_, max_, current_range_signal, index, target_el, get_offset_value = (value, how_many) => value + how_many) {
|
|
1362
1377
|
let value_as_number = +target_el.value;
|
|
@@ -1605,37 +1620,40 @@ function $1c8cac76cb67e9af$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
1605
1620
|
return has_expandable();
|
|
1606
1621
|
},
|
|
1607
1622
|
get children() {
|
|
1608
|
-
return
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1623
|
+
return (() => {
|
|
1624
|
+
const is_open = $i7OB2$createMemo(() => {
|
|
1625
|
+
const v = value();
|
|
1626
|
+
if (!v)
|
|
1627
|
+
// only to prevent cleanup errors
|
|
1628
|
+
return $i7OB2$createSignal(false);
|
|
1629
|
+
const {
|
|
1630
|
+
is_expanded_: {
|
|
1631
|
+
ui_should_show_expanded_: ui_should_show_expanded_,
|
|
1632
|
+
set_user_expanded_: set_user_expanded_
|
|
1617
1633
|
}
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1634
|
+
} = v;
|
|
1635
|
+
return [ui_should_show_expanded_, set_user_expanded_];
|
|
1636
|
+
});
|
|
1637
|
+
return $i7OB2$createComponent((0, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d), {
|
|
1638
|
+
get details_() {
|
|
1639
|
+
return $i7OB2$ssr($1c8cac76cb67e9af$var$_tmpl$3, $i7OB2$ssrHydrationKey());
|
|
1640
|
+
},
|
|
1641
|
+
get summary_() {
|
|
1642
|
+
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), {
|
|
1643
|
+
i18n_: i18n_,
|
|
1644
|
+
get expanded_() {
|
|
1645
|
+
return $i7OB2$createMemo(() => value()?.is_expanded_?.ui_should_show_expanded_?.() ?? false);
|
|
1630
1646
|
}
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1647
|
+
})));
|
|
1648
|
+
},
|
|
1649
|
+
get is_open_() {
|
|
1650
|
+
return is_open();
|
|
1651
|
+
},
|
|
1652
|
+
get children() {
|
|
1653
|
+
return $1c8cac76cb67e9af$var$render_stuff($i7OB2$createMemo(() => value()?.children_ || {}), existing_filter, i18n_);
|
|
1654
|
+
}
|
|
1655
|
+
});
|
|
1656
|
+
})();
|
|
1639
1657
|
}
|
|
1640
1658
|
})));
|
|
1641
1659
|
})();
|
|
@@ -1698,7 +1716,7 @@ function $1c8cac76cb67e9af$var$create_updating_signal({
|
|
|
1698
1716
|
// wait for the children to have populated and us to have received the correct value_ and name_ values
|
|
1699
1717
|
let updating_blocked = false;
|
|
1700
1718
|
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));
|
|
1701
|
-
signal_.push(...$i7OB2$createSignal(index_of_us_in_selected_filter >= 0
|
|
1719
|
+
signal_.push(...$i7OB2$createSignal(index_of_us_in_selected_filter >= 0));
|
|
1702
1720
|
const [read_checked, write_checked] = signal_;
|
|
1703
1721
|
const child_objects = Object.values(self_.children_);
|
|
1704
1722
|
const get_child_object_values = child_objects.map(({
|