@depict-ai/ui 2.0.1 → 2.0.3
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 +209 -80
- package/ES10/index.d.ts +5 -1
- package/ES10/index.js +210 -82
- package/latest/index.cjs +203 -77
- package/latest/index.d.ts +5 -1
- package/latest/index.js +204 -79
- package/package.json +2 -2
- package/server/ES10/index.cjs +164 -28
- package/server/ES10/index.d.ts +5 -1
- package/server/ES10/index.js +165 -30
- package/server/latest/index.cjs +158 -25
- package/server/latest/index.d.ts +5 -1
- package/server/latest/index.js +159 -27
- package/locales/require.js +0 -1152
package/latest/index.js
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
import { add_to_version_info as $9HbP8$add_to_version_info,
|
|
1
|
+
import { add_to_version_info as $9HbP8$add_to_version_info, catchify as $9HbP8$catchify, slider_fractional_factory as $9HbP8$slider_fractional_factory, make_random_classname as $9HbP8$make_random_classname, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, report as $9HbP8$report, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, observer as $9HbP8$observer, is_safari as $9HbP8$is_safari, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, dlog as $9HbP8$dlog, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, javascript_media_query as $9HbP8$javascript_media_query, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, edit_current_page_meta_tags as $9HbP8$edit_current_page_meta_tags, use_href_accessor as $9HbP8$use_href_accessor, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, queueMacroTask as $9HbP8$queueMacroTask, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, ListenableSet as $9HbP8$ListenableSet, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
|
|
2
|
+
import { createSignal as $9HbP8$createSignal, onCleanup as $9HbP8$onCleanup, createMemo as $9HbP8$createMemo, createResource as $9HbP8$createResource, Suspense as $9HbP8$Suspense, Show as $9HbP8$Show, createRenderEffect as $9HbP8$createRenderEffect, createRoot as $9HbP8$createRoot, For as $9HbP8$For, getOwner as $9HbP8$getOwner, runWithOwner as $9HbP8$runWithOwner, createEffect as $9HbP8$createEffect, untrack as $9HbP8$untrack, createUniqueId as $9HbP8$createUniqueId, createComputed as $9HbP8$createComputed, ErrorBoundary as $9HbP8$ErrorBoundary, Index as $9HbP8$Index, on as $9HbP8$on, batch as $9HbP8$batch, createReaction as $9HbP8$createReaction } from "solid-js";
|
|
2
3
|
import { template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, insert as $9HbP8$insert, createComponent as $9HbP8$createComponent, mergeProps as $9HbP8$mergeProps, isServer as $9HbP8$isServer, spread as $9HbP8$spread, runHydrationEvents as $9HbP8$runHydrationEvents, addEventListener as $9HbP8$addEventListener, className as $9HbP8$className, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, effect as $9HbP8$effect, classList as $9HbP8$classList, setAttribute as $9HbP8$setAttribute, getNextMarker as $9HbP8$getNextMarker, style as $9HbP8$style, Dynamic as $9HbP8$Dynamic, use as $9HbP8$use } from "solid-js/web";
|
|
3
|
-
import { createMemo as $9HbP8$createMemo, createResource as $9HbP8$createResource, Suspense as $9HbP8$Suspense, Show as $9HbP8$Show, createSignal as $9HbP8$createSignal, createRenderEffect as $9HbP8$createRenderEffect, createRoot as $9HbP8$createRoot, onCleanup as $9HbP8$onCleanup, For as $9HbP8$For, getOwner as $9HbP8$getOwner, runWithOwner as $9HbP8$runWithOwner, createEffect as $9HbP8$createEffect, untrack as $9HbP8$untrack, createUniqueId as $9HbP8$createUniqueId, createComputed as $9HbP8$createComputed, ErrorBoundary as $9HbP8$ErrorBoundary, Index as $9HbP8$Index, on as $9HbP8$on, batch as $9HbP8$batch, createReaction as $9HbP8$createReaction } from "solid-js";
|
|
4
4
|
|
|
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.3";
|
|
9
|
+
|
|
10
|
+
/** @jsxImportSource solid-js */
|
|
11
|
+
|
|
12
|
+
function $0fdb37d8ddabef25$export$9f191182275e9ef(what_to_watch) {
|
|
13
|
+
const [size, setSize] = $9HbP8$createSignal();
|
|
14
|
+
const resizeObserver = new ResizeObserver($9HbP8$catchify(records => {
|
|
15
|
+
for (let j = 0; j < records.length; j++) {
|
|
16
|
+
const width = records[j].borderBoxSize?.[0]?.inlineSize ?? what_to_watch.getBoundingClientRect().width;
|
|
17
|
+
setSize(width);
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
resizeObserver.observe(what_to_watch);
|
|
21
|
+
$9HbP8$onCleanup(() => resizeObserver.disconnect());
|
|
22
|
+
return size;
|
|
23
|
+
}
|
|
9
24
|
const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
|
|
10
25
|
const cols_at_size = [];
|
|
11
26
|
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
@@ -1362,9 +1377,9 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
|
|
|
1362
1377
|
return outmost_element;
|
|
1363
1378
|
}
|
|
1364
1379
|
$9HbP8$delegateEvents(["click"]);
|
|
1365
|
-
const $
|
|
1366
|
-
$
|
|
1367
|
-
const $
|
|
1380
|
+
const $49b79728e7d9e2a1$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<span class="count"></span>`, 2),
|
|
1381
|
+
$49b79728e7d9e2a1$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<label class="input-row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text line-clamp"></span></div><!#><!/></label>`, 11);
|
|
1382
|
+
const $49b79728e7d9e2a1$export$48513f6b9f8ce62d = props => {
|
|
1368
1383
|
// 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
|
|
1369
1384
|
const count = $9HbP8$createMemo(() => props.count_);
|
|
1370
1385
|
const label = $9HbP8$createMemo(() => props.label_);
|
|
@@ -1373,7 +1388,7 @@ const $87c712b5b33f24f7$export$48513f6b9f8ce62d = props => {
|
|
|
1373
1388
|
const is_count_zero = $9HbP8$createMemo(() => props.is_count_zero_ || count() === 0);
|
|
1374
1389
|
const id = $9HbP8$make_random_classname();
|
|
1375
1390
|
return (/* We can't use actual margin because ExpandingContainer gets messed up */(() => {
|
|
1376
|
-
const _el$ = $9HbP8$getNextElement($
|
|
1391
|
+
const _el$ = $9HbP8$getNextElement($49b79728e7d9e2a1$var$_tmpl$2),
|
|
1377
1392
|
_el$2 = _el$.firstChild,
|
|
1378
1393
|
_el$3 = _el$2.firstChild,
|
|
1379
1394
|
_el$4 = _el$3.nextSibling,
|
|
@@ -1400,7 +1415,7 @@ const $87c712b5b33f24f7$export$48513f6b9f8ce62d = props => {
|
|
|
1400
1415
|
return count() != undefined;
|
|
1401
1416
|
},
|
|
1402
1417
|
get children() {
|
|
1403
|
-
const _el$6 = $9HbP8$getNextElement($
|
|
1418
|
+
const _el$6 = $9HbP8$getNextElement($49b79728e7d9e2a1$var$_tmpl$);
|
|
1404
1419
|
$9HbP8$insert(_el$6, count);
|
|
1405
1420
|
return _el$6;
|
|
1406
1421
|
}
|
|
@@ -1488,7 +1503,7 @@ function $a4601e6bea3ed1e6$export$dd948f91abc3a1c4({
|
|
|
1488
1503
|
});
|
|
1489
1504
|
const render_checkbox = checkbox => {
|
|
1490
1505
|
// Checkbox always calls the getters in props, so we don't wrap these values into memos
|
|
1491
|
-
return $9HbP8$createComponent((0, $
|
|
1506
|
+
return $9HbP8$createComponent((0, $49b79728e7d9e2a1$export$48513f6b9f8ce62d), {
|
|
1492
1507
|
get value_() {
|
|
1493
1508
|
return checkbox().value_;
|
|
1494
1509
|
},
|
|
@@ -2190,7 +2205,7 @@ function $1c8cac76cb67e9af$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
2190
2205
|
[_el$8, _co$3] = $9HbP8$getNextMarker(_el$7.nextSibling),
|
|
2191
2206
|
_el$9 = _el$8.nextSibling,
|
|
2192
2207
|
[_el$10, _co$4] = $9HbP8$getNextMarker(_el$9.nextSibling);
|
|
2193
|
-
$9HbP8$insert(_el$6, $9HbP8$createComponent((0, $
|
|
2208
|
+
$9HbP8$insert(_el$6, $9HbP8$createComponent((0, $49b79728e7d9e2a1$export$48513f6b9f8ce62d), {
|
|
2194
2209
|
get value_() {
|
|
2195
2210
|
return JSON.stringify(value()?.value_);
|
|
2196
2211
|
},
|
|
@@ -2444,9 +2459,11 @@ function $1c8cac76cb67e9af$var$expand_until_choice(data_structure) {
|
|
|
2444
2459
|
}
|
|
2445
2460
|
});
|
|
2446
2461
|
}
|
|
2447
|
-
const $93716a9ad0dea854$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="checkbox-grid"></div>`, 2),
|
|
2462
|
+
const $93716a9ad0dea854$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="checkbox-grid" style="position:absolute;z-index:-1;pointer-events:none;opacity:0"></div>`, 2),
|
|
2448
2463
|
$93716a9ad0dea854$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<span class="count-wrapper"><span class="count"></span></span>`, 4),
|
|
2449
|
-
$93716a9ad0dea854$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<button
|
|
2464
|
+
$93716a9ad0dea854$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<button><!#><!/><!#><!/></button>`, 6);
|
|
2465
|
+
const $93716a9ad0dea854$var$gap_px = 5;
|
|
2466
|
+
const $93716a9ad0dea854$var$max_columns = 3;
|
|
2450
2467
|
const $93716a9ad0dea854$export$414f6a19d38e655c = ({
|
|
2451
2468
|
filter_: filter_,
|
|
2452
2469
|
selected_filters_: [get_selected_filters, set_selected_filters]
|
|
@@ -2469,74 +2486,182 @@ const $93716a9ad0dea854$export$414f6a19d38e655c = ({
|
|
|
2469
2486
|
count_: meta.counts?.[index]
|
|
2470
2487
|
}));
|
|
2471
2488
|
});
|
|
2472
|
-
|
|
2489
|
+
const [sizes_set, set_sizes_set] = $9HbP8$createSignal(new Set(), {
|
|
2490
|
+
equals: false
|
|
2491
|
+
});
|
|
2492
|
+
const [cols_at_size, set_cols_at_size] = $9HbP8$createSignal([[1, "0px", ""]]);
|
|
2493
|
+
const [container, set_container] = $9HbP8$createSignal();
|
|
2494
|
+
const container_width_accessor = $9HbP8$createMemo(() => {
|
|
2495
|
+
const element = container();
|
|
2496
|
+
if (!element) return;
|
|
2497
|
+
return $0fdb37d8ddabef25$export$9f191182275e9ef(element);
|
|
2498
|
+
});
|
|
2499
|
+
const [shadow_children, set_shadow_children] = $9HbP8$createSignal(new Set(), {
|
|
2500
|
+
equals: false
|
|
2501
|
+
});
|
|
2502
|
+
const shadow_grid = (() => {
|
|
2473
2503
|
const _el$ = $9HbP8$getNextElement($93716a9ad0dea854$var$_tmpl$);
|
|
2474
|
-
$9HbP8$insert(_el$,
|
|
2475
|
-
get each() {
|
|
2476
|
-
return buttons();
|
|
2477
|
-
},
|
|
2478
|
-
children: value => {
|
|
2479
|
-
const is_selected = $9HbP8$createMemo(() => existing_filter()?.data?.includes(value().value_));
|
|
2480
|
-
return (() => {
|
|
2481
|
-
const _el$2 = $9HbP8$getNextElement($93716a9ad0dea854$var$_tmpl$3),
|
|
2482
|
-
_el$5 = _el$2.firstChild,
|
|
2483
|
-
[_el$6, _co$] = $9HbP8$getNextMarker(_el$5.nextSibling),
|
|
2484
|
-
_el$7 = _el$6.nextSibling,
|
|
2485
|
-
[_el$8, _co$2] = $9HbP8$getNextMarker(_el$7.nextSibling);
|
|
2486
|
-
$9HbP8$addEventListener(_el$2, "click", $9HbP8$catchify(() => {
|
|
2487
|
-
const set_filter = existing_filter();
|
|
2488
|
-
const {
|
|
2489
|
-
field: field,
|
|
2490
|
-
op: op
|
|
2491
|
-
} = filter_();
|
|
2492
|
-
const base_object = set_filter ? set_filter : {
|
|
2493
|
-
op: op,
|
|
2494
|
-
field: field
|
|
2495
|
-
};
|
|
2496
|
-
const old_data = base_object.data;
|
|
2497
|
-
const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
|
|
2498
|
-
const new_filter_object = {
|
|
2499
|
-
...base_object,
|
|
2500
|
-
data: new_data
|
|
2501
|
-
};
|
|
2502
|
-
if (!is_selected()) new_filter_object.data.push(value().value_);else new_filter_object.data = new_filter_object.data.filter(v => v !== value().value_);
|
|
2503
|
-
const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
|
|
2504
|
-
set_selected_filters(selected_filters);
|
|
2505
|
-
}), true);
|
|
2506
|
-
$9HbP8$insert(_el$2, () => value().value_, _el$6, _co$);
|
|
2507
|
-
$9HbP8$insert(_el$2, $9HbP8$createComponent((0, $9HbP8$Show), {
|
|
2508
|
-
get when() {
|
|
2509
|
-
return value().count_ != undefined;
|
|
2510
|
-
},
|
|
2511
|
-
get children() {
|
|
2512
|
-
const _el$3 = $9HbP8$getNextElement($93716a9ad0dea854$var$_tmpl$2),
|
|
2513
|
-
_el$4 = _el$3.firstChild;
|
|
2514
|
-
$9HbP8$insert(_el$4, () => value().count_);
|
|
2515
|
-
return _el$3;
|
|
2516
|
-
}
|
|
2517
|
-
}), _el$8, _co$2);
|
|
2518
|
-
$9HbP8$effect(_p$ => {
|
|
2519
|
-
const _v$ = value().count_ === 0 && !is_selected(),
|
|
2520
|
-
_v$2 = !is_selected(),
|
|
2521
|
-
_v$3 = !!is_selected();
|
|
2522
|
-
_v$ !== _p$._v$ && (_el$2.disabled = _p$._v$ = _v$);
|
|
2523
|
-
_v$2 !== _p$._v$2 && _el$2.classList.toggle("minor", _p$._v$2 = _v$2);
|
|
2524
|
-
_v$3 !== _p$._v$3 && _el$2.classList.toggle("major", _p$._v$3 = _v$3);
|
|
2525
|
-
return _p$;
|
|
2526
|
-
}, {
|
|
2527
|
-
_v$: undefined,
|
|
2528
|
-
_v$2: undefined,
|
|
2529
|
-
_v$3: undefined
|
|
2530
|
-
});
|
|
2531
|
-
$9HbP8$runHydrationEvents();
|
|
2532
|
-
return _el$2;
|
|
2533
|
-
})();
|
|
2534
|
-
}
|
|
2535
|
-
}));
|
|
2504
|
+
$9HbP8$insert(_el$, () => [...shadow_children()]);
|
|
2536
2505
|
return _el$;
|
|
2537
|
-
})();
|
|
2506
|
+
})(); // for getting the smallest possible sizes of all the items
|
|
2507
|
+
$9HbP8$createEffect(() => {
|
|
2508
|
+
const container_width = container_width_accessor()?.();
|
|
2509
|
+
if (container_width == undefined) return;
|
|
2510
|
+
$93716a9ad0dea854$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
|
|
2511
|
+
});
|
|
2512
|
+
return [shadow_grid, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), {
|
|
2513
|
+
get cols_at_size() {
|
|
2514
|
+
return cols_at_size();
|
|
2515
|
+
},
|
|
2516
|
+
grid_spacing: $93716a9ad0dea854$var$gap_px + "px",
|
|
2517
|
+
rows: "all",
|
|
2518
|
+
layout: "grid",
|
|
2519
|
+
element_attributes: {
|
|
2520
|
+
class: "checkbox-grid",
|
|
2521
|
+
ref: el => set_container(el)
|
|
2522
|
+
},
|
|
2523
|
+
get children() {
|
|
2524
|
+
return $9HbP8$createComponent((0, $9HbP8$Index), {
|
|
2525
|
+
get each() {
|
|
2526
|
+
return buttons();
|
|
2527
|
+
},
|
|
2528
|
+
children: value => {
|
|
2529
|
+
const is_selected = $9HbP8$createMemo(() => existing_filter()?.data?.includes(value().value_));
|
|
2530
|
+
const MakeButton = attributes => (() => {
|
|
2531
|
+
const _el$2 = $9HbP8$getNextElement($93716a9ad0dea854$var$_tmpl$3),
|
|
2532
|
+
_el$5 = _el$2.firstChild,
|
|
2533
|
+
[_el$6, _co$] = $9HbP8$getNextMarker(_el$5.nextSibling),
|
|
2534
|
+
_el$7 = _el$6.nextSibling,
|
|
2535
|
+
[_el$8, _co$2] = $9HbP8$getNextMarker(_el$7.nextSibling);
|
|
2536
|
+
$9HbP8$spread(_el$2, $9HbP8$mergeProps(attributes, {
|
|
2537
|
+
get disabled() {
|
|
2538
|
+
return $9HbP8$memo(() => value().count_ === 0)() && !is_selected();
|
|
2539
|
+
},
|
|
2540
|
+
get classList() {
|
|
2541
|
+
return {
|
|
2542
|
+
minor: !is_selected(),
|
|
2543
|
+
major: is_selected(),
|
|
2544
|
+
"major-minor-transition": true
|
|
2545
|
+
};
|
|
2546
|
+
},
|
|
2547
|
+
get onClick() {
|
|
2548
|
+
return $9HbP8$catchify(() => {
|
|
2549
|
+
const set_filter = existing_filter();
|
|
2550
|
+
const {
|
|
2551
|
+
field: field,
|
|
2552
|
+
op: op
|
|
2553
|
+
} = filter_();
|
|
2554
|
+
const base_object = set_filter ? set_filter : {
|
|
2555
|
+
op: op,
|
|
2556
|
+
field: field
|
|
2557
|
+
};
|
|
2558
|
+
const old_data = base_object.data;
|
|
2559
|
+
const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
|
|
2560
|
+
const new_filter_object = {
|
|
2561
|
+
...base_object,
|
|
2562
|
+
data: new_data
|
|
2563
|
+
};
|
|
2564
|
+
if (!is_selected()) new_filter_object.data.push(value().value_);else new_filter_object.data = new_filter_object.data.filter(v => v !== value().value_);
|
|
2565
|
+
const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
|
|
2566
|
+
set_selected_filters(selected_filters);
|
|
2567
|
+
});
|
|
2568
|
+
}
|
|
2569
|
+
}), false, true);
|
|
2570
|
+
$9HbP8$insert(_el$2, () => value().value_, _el$6, _co$);
|
|
2571
|
+
$9HbP8$insert(_el$2, $9HbP8$createComponent((0, $9HbP8$Show), {
|
|
2572
|
+
get when() {
|
|
2573
|
+
return value().count_ != undefined;
|
|
2574
|
+
},
|
|
2575
|
+
get children() {
|
|
2576
|
+
const _el$3 = $9HbP8$getNextElement($93716a9ad0dea854$var$_tmpl$2),
|
|
2577
|
+
_el$4 = _el$3.firstChild;
|
|
2578
|
+
$9HbP8$insert(_el$4, () => value().count_);
|
|
2579
|
+
return _el$3;
|
|
2580
|
+
}
|
|
2581
|
+
}), _el$8, _co$2);
|
|
2582
|
+
$9HbP8$runHydrationEvents();
|
|
2583
|
+
return _el$2;
|
|
2584
|
+
})();
|
|
2585
|
+
const invisible_size_button = $9HbP8$createComponent(MakeButton, {});
|
|
2586
|
+
const smallest_possible_size = $0fdb37d8ddabef25$export$9f191182275e9ef(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
|
|
2587
|
+
const sizes_value = $9HbP8$untrack(sizes_set);
|
|
2588
|
+
const shadow_children_value = $9HbP8$untrack(shadow_children);
|
|
2589
|
+
sizes_value.add(smallest_possible_size);
|
|
2590
|
+
set_sizes_set(sizes_value);
|
|
2591
|
+
shadow_children_value.add(invisible_size_button);
|
|
2592
|
+
set_shadow_children(shadow_children_value);
|
|
2593
|
+
$9HbP8$onCleanup(() => {
|
|
2594
|
+
const sizes_value = $9HbP8$untrack(sizes_set);
|
|
2595
|
+
const shadow_children_value = $9HbP8$untrack(shadow_children);
|
|
2596
|
+
sizes_value.delete(smallest_possible_size);
|
|
2597
|
+
set_sizes_set(sizes_value);
|
|
2598
|
+
shadow_children_value.delete(invisible_size_button);
|
|
2599
|
+
set_shadow_children(shadow_children_value);
|
|
2600
|
+
});
|
|
2601
|
+
// The actual button that will be visible
|
|
2602
|
+
return $9HbP8$createComponent(MakeButton, {});
|
|
2603
|
+
}
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2606
|
+
})];
|
|
2538
2607
|
};
|
|
2539
|
-
|
|
2608
|
+
/**
|
|
2609
|
+
* Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
|
|
2610
|
+
*/
|
|
2611
|
+
function $93716a9ad0dea854$var$adjust_sizes(container_width, sizes, set_cols_at_size) {
|
|
2612
|
+
let current_row_index = 0;
|
|
2613
|
+
let current_row_items = [];
|
|
2614
|
+
const column_to_row_result = {};
|
|
2615
|
+
const check_would_fit_evenly = (min_size_of_item, at_number_of_columnns) => {
|
|
2616
|
+
const would_have_even_size = container_width / at_number_of_columnns - (at_number_of_columnns * 2 - 2) * ($93716a9ad0dea854$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)
|
|
2617
|
+
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
|
|
2618
|
+
};
|
|
2619
|
+
|
|
2620
|
+
for (const size_item of sizes) {
|
|
2621
|
+
const size = size_item();
|
|
2622
|
+
if (size == undefined) return; // Only do stuff if we know all the sizes
|
|
2623
|
+
const current_row_length = current_row_items.length;
|
|
2624
|
+
const can_add_another_column_initial_val = current_row_length < $93716a9ad0dea854$var$max_columns; // allow max 4 items per row
|
|
2625
|
+
let can_add_another_column = can_add_another_column_initial_val;
|
|
2626
|
+
if (can_add_another_column)
|
|
2627
|
+
// can we actually? Since adding another column changes the size of all elements in the row we need to check all of them
|
|
2628
|
+
for (let i = -1; i < current_row_length; i++) {
|
|
2629
|
+
// -1 is for the new item we're adding and every item is guaranteed to exist
|
|
2630
|
+
const size_to_check = current_row_items[i] ?? size;
|
|
2631
|
+
const would_have_columns = current_row_length + 1; // if we added another column
|
|
2632
|
+
const would_fit_evenly = check_would_fit_evenly(size_to_check, would_have_columns); // see comments in check_would_fit_evenly
|
|
2633
|
+
if (!would_fit_evenly) {
|
|
2634
|
+
can_add_another_column = false;
|
|
2635
|
+
break;
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
if (can_add_another_column) current_row_items.push(size);else {
|
|
2639
|
+
column_to_row_result[++current_row_index] = current_row_length || 1; // overrides is indexed by 1 it seems, therefore ++curent_row_index
|
|
2640
|
+
current_row_items = [size]; // save current item for next row
|
|
2641
|
+
}
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
const items_left_to_add = current_row_items.length;
|
|
2645
|
+
if (items_left_to_add) {
|
|
2646
|
+
let num_columns = 1; // We want to have as close to max_columns as possible in the last row
|
|
2647
|
+
let fits = true;
|
|
2648
|
+
do
|
|
2649
|
+
// Check if more columns would fit
|
|
2650
|
+
for (let i = 0; i < items_left_to_add; i++) {
|
|
2651
|
+
const item = current_row_items[i];
|
|
2652
|
+
const would_fit_evenly = check_would_fit_evenly(item, num_columns + 1);
|
|
2653
|
+
if (!would_fit_evenly) {
|
|
2654
|
+
fits = false;
|
|
2655
|
+
break;
|
|
2656
|
+
}
|
|
2657
|
+
} while (fits && ++num_columns < $93716a9ad0dea854$var$max_columns);
|
|
2658
|
+
column_to_row_result[++current_row_index] = num_columns; // Add last row that's left after loop finished
|
|
2659
|
+
}
|
|
2660
|
+
|
|
2661
|
+
set_cols_at_size([[1, "0px", "", null, {
|
|
2662
|
+
overrides: column_to_row_result
|
|
2663
|
+
}]]);
|
|
2664
|
+
}
|
|
2540
2665
|
function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
|
|
2541
2666
|
const signal = $9HbP8$createSignal(false);
|
|
2542
2667
|
$9HbP8$onCleanup($9HbP8$javascript_media_query(media_query, ({
|
|
@@ -2581,7 +2706,7 @@ function $e731d52d97444b7c$export$82ed4b28ecb67608({
|
|
|
2581
2706
|
const hex_color = $9HbP8$createMemo(() => checkbox().value_.split(";")?.[1] || "");
|
|
2582
2707
|
const rgb_color = $9HbP8$createMemo(() => $9HbP8$hex_to_rgb(hex_color()));
|
|
2583
2708
|
const black_contrast_better = $9HbP8$createMemo(() => rgb_color() ? $e731d52d97444b7c$var$does_black_contrast_better(rgb_color()) : false);
|
|
2584
|
-
const input_row = $9HbP8$createComponent((0, $
|
|
2709
|
+
const input_row = $9HbP8$createComponent((0, $49b79728e7d9e2a1$export$48513f6b9f8ce62d), {
|
|
2585
2710
|
get value_() {
|
|
2586
2711
|
return checkbox().value_;
|
|
2587
2712
|
},
|
|
@@ -10573,4 +10698,4 @@ const $4690a06c8489dcd0$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
|
|
|
10573
10698
|
const $4690a06c8489dcd0$export$864d304a0bc46829 = "2%";
|
|
10574
10699
|
const $4690a06c8489dcd0$export$7bf543b9d9be2c22 = (0, $e4615ecd1849548f$export$b91cec6bdc6b32a1);
|
|
10575
10700
|
$9HbP8$add_to_version_info("ui", (0, $ec291e0010116877$export$83d89fbfd8236492));
|
|
10576
|
-
export { $ee116da074deb002$export$9574e176201e5e8d as RecommendationSlider, $9ea5383493360761$export$9756467d34d91cdb as RecommendationGrid, $e8ffe11ed01df0fe$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $e8ffe11ed01df0fe$export$e6fffe67d4cdd848 as makeSizeAccessor, $f18d425032111270$export$94026ee33dbabc26 as ImageContainer, $b7436a6d1fd64e3b$export$b69d0d92862de18b as SentryErrorBoundary, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d as ExpandingDetails, $c16e74cfe125bb05$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $1adfe60f3a14a1d7$export$fecbb157621501bd as SelectedFilters, $fab07f52c9861732$export$3f1a388cc0d8fed7 as FilterBody, $5efb5894079b220e$export$b288c38ae3fddb56 as create_modified_filters, $c8d5ff4524619fcd$export$d21e32dfedac04be as SolidLayout, $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, $a6e23a834336fc19$export$824dde41348efed1 as embedded_num_products, $c9312089e8983364$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 };
|
|
10701
|
+
export { $0fdb37d8ddabef25$export$9f191182275e9ef as make_accurate_size_accessor, $ee116da074deb002$export$9574e176201e5e8d as RecommendationSlider, $9ea5383493360761$export$9756467d34d91cdb as RecommendationGrid, $e8ffe11ed01df0fe$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $e8ffe11ed01df0fe$export$e6fffe67d4cdd848 as makeSizeAccessor, $f18d425032111270$export$94026ee33dbabc26 as ImageContainer, $b7436a6d1fd64e3b$export$b69d0d92862de18b as SentryErrorBoundary, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d as ExpandingDetails, $c16e74cfe125bb05$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $1adfe60f3a14a1d7$export$fecbb157621501bd as SelectedFilters, $fab07f52c9861732$export$3f1a388cc0d8fed7 as FilterBody, $5efb5894079b220e$export$b288c38ae3fddb56 as create_modified_filters, $c8d5ff4524619fcd$export$d21e32dfedac04be as SolidLayout, $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, $a6e23a834336fc19$export$824dde41348efed1 as embedded_num_products, $c9312089e8983364$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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
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
6
|
"sass": "styles.scss",
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
"@babel/plugin-transform-typescript": "^7.22.9",
|
|
237
237
|
"@babel/runtime": "latest",
|
|
238
238
|
"@babel/runtime-corejs3": "^7.22.6",
|
|
239
|
-
"@depict-ai/plp-styling": "^1.2.
|
|
239
|
+
"@depict-ai/plp-styling": "^1.2.4",
|
|
240
240
|
"@depict-ai/types": "^1.0.39",
|
|
241
241
|
"@depict-ai/utilishared": "^1.0.41",
|
|
242
242
|
"solid-js": "^1.7.3"
|