@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/ES10/index.cjs
CHANGED
|
@@ -66,7 +66,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
|
|
|
66
66
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
|
|
67
67
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
68
68
|
/*! Depict.ai search and product listing SDK */
|
|
69
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.
|
|
69
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.2";
|
|
70
70
|
const $5401a6698b0c0658$var$transform_elements = sorted_cols_at_size => {
|
|
71
71
|
const cols_at_size = [];
|
|
72
72
|
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
@@ -1495,9 +1495,9 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
|
|
|
1495
1495
|
return outmost_element;
|
|
1496
1496
|
}
|
|
1497
1497
|
$52FdA$solidjsweb.delegateEvents(["click"]);
|
|
1498
|
-
const $
|
|
1499
|
-
$
|
|
1500
|
-
const $
|
|
1498
|
+
const $902a0ca2b52f3898$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class="count"></span>`, 2),
|
|
1499
|
+
$902a0ca2b52f3898$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.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);
|
|
1500
|
+
const $902a0ca2b52f3898$export$48513f6b9f8ce62d = props => {
|
|
1501
1501
|
// 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
|
|
1502
1502
|
const count = $52FdA$solidjs.createMemo(() => props.count_);
|
|
1503
1503
|
const label = $52FdA$solidjs.createMemo(() => props.label_);
|
|
@@ -1506,7 +1506,7 @@ const $6b92e147c6e24046$export$48513f6b9f8ce62d = props => {
|
|
|
1506
1506
|
const is_count_zero = $52FdA$solidjs.createMemo(() => props.is_count_zero_ || count() === 0);
|
|
1507
1507
|
const id = $52FdA$depictaiutilishared.make_random_classname();
|
|
1508
1508
|
return (/* We can't use actual margin because ExpandingContainer gets messed up */(() => {
|
|
1509
|
-
const _el$ = $52FdA$solidjsweb.getNextElement($
|
|
1509
|
+
const _el$ = $52FdA$solidjsweb.getNextElement($902a0ca2b52f3898$var$_tmpl$2),
|
|
1510
1510
|
_el$2 = _el$.firstChild,
|
|
1511
1511
|
_el$3 = _el$2.firstChild,
|
|
1512
1512
|
_el$4 = _el$3.nextSibling,
|
|
@@ -1537,7 +1537,7 @@ const $6b92e147c6e24046$export$48513f6b9f8ce62d = props => {
|
|
|
1537
1537
|
return count() != undefined;
|
|
1538
1538
|
},
|
|
1539
1539
|
get children() {
|
|
1540
|
-
const _el$6 = $52FdA$solidjsweb.getNextElement($
|
|
1540
|
+
const _el$6 = $52FdA$solidjsweb.getNextElement($902a0ca2b52f3898$var$_tmpl$);
|
|
1541
1541
|
$52FdA$solidjsweb.insert(_el$6, count);
|
|
1542
1542
|
return _el$6;
|
|
1543
1543
|
}
|
|
@@ -1633,7 +1633,7 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
|
|
|
1633
1633
|
});
|
|
1634
1634
|
const render_checkbox = checkbox => {
|
|
1635
1635
|
// Checkbox always calls the getters in props, so we don't wrap these values into memos
|
|
1636
|
-
return $52FdA$solidjsweb.createComponent((0, $
|
|
1636
|
+
return $52FdA$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
|
|
1637
1637
|
get value_() {
|
|
1638
1638
|
return checkbox().value_;
|
|
1639
1639
|
},
|
|
@@ -2377,7 +2377,7 @@ function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
2377
2377
|
[_el$8, _co$3] = $52FdA$solidjsweb.getNextMarker(_el$7.nextSibling),
|
|
2378
2378
|
_el$9 = _el$8.nextSibling,
|
|
2379
2379
|
[_el$10, _co$4] = $52FdA$solidjsweb.getNextMarker(_el$9.nextSibling);
|
|
2380
|
-
$52FdA$solidjsweb.insert(_el$6, $52FdA$solidjsweb.createComponent((0, $
|
|
2380
|
+
$52FdA$solidjsweb.insert(_el$6, $52FdA$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
|
|
2381
2381
|
get value_() {
|
|
2382
2382
|
var _value2;
|
|
2383
2383
|
return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
|
|
@@ -2667,9 +2667,27 @@ function $9c1d49181fb3002a$var$expand_until_choice(data_structure) {
|
|
|
2667
2667
|
}
|
|
2668
2668
|
});
|
|
2669
2669
|
}
|
|
2670
|
-
|
|
2670
|
+
|
|
2671
|
+
/** @jsxImportSource solid-js */
|
|
2672
|
+
|
|
2673
|
+
function $13671aa5e984acd9$export$9f191182275e9ef(what_to_watch) {
|
|
2674
|
+
const [size, setSize] = $52FdA$solidjs.createSignal();
|
|
2675
|
+
const resizeObserver = new ResizeObserver($52FdA$depictaiutilishared.catchify(records => {
|
|
2676
|
+
for (let j = 0; j < records.length; j++) {
|
|
2677
|
+
var _records$j$borderBoxS, _records$j$borderBoxS2, _records$j$borderBoxS3;
|
|
2678
|
+
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;
|
|
2679
|
+
setSize(width);
|
|
2680
|
+
}
|
|
2681
|
+
}));
|
|
2682
|
+
resizeObserver.observe(what_to_watch);
|
|
2683
|
+
$52FdA$solidjs.onCleanup(() => resizeObserver.disconnect());
|
|
2684
|
+
return size;
|
|
2685
|
+
}
|
|
2686
|
+
const $cd0e5524f9476f9b$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="checkbox-grid" style="position:absolute;z-index:-1;pointer-events:none;opacity:0"></div>`, 2),
|
|
2671
2687
|
$cd0e5524f9476f9b$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class="count-wrapper"><span class="count"></span></span>`, 4),
|
|
2672
|
-
$cd0e5524f9476f9b$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<button
|
|
2688
|
+
$cd0e5524f9476f9b$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<button><!#><!/><!#><!/></button>`, 6);
|
|
2689
|
+
const $cd0e5524f9476f9b$var$gap_px = 5;
|
|
2690
|
+
const $cd0e5524f9476f9b$var$max_columns = 3;
|
|
2673
2691
|
const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
|
|
2674
2692
|
let {
|
|
2675
2693
|
filter_: filter_,
|
|
@@ -2699,77 +2717,187 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
|
|
|
2699
2717
|
};
|
|
2700
2718
|
});
|
|
2701
2719
|
});
|
|
2702
|
-
|
|
2720
|
+
const [sizes_set, set_sizes_set] = $52FdA$solidjs.createSignal(new Set(), {
|
|
2721
|
+
equals: false
|
|
2722
|
+
});
|
|
2723
|
+
const [cols_at_size, set_cols_at_size] = $52FdA$solidjs.createSignal([[1, "0px", ""]]);
|
|
2724
|
+
const [container, set_container] = $52FdA$solidjs.createSignal();
|
|
2725
|
+
const container_width_accessor = $52FdA$solidjs.createMemo(() => {
|
|
2726
|
+
const element = container();
|
|
2727
|
+
if (!element) return;
|
|
2728
|
+
return $13671aa5e984acd9$export$9f191182275e9ef(element);
|
|
2729
|
+
});
|
|
2730
|
+
const [shadow_children, set_shadow_children] = $52FdA$solidjs.createSignal(new Set(), {
|
|
2731
|
+
equals: false
|
|
2732
|
+
});
|
|
2733
|
+
const shadow_grid = (() => {
|
|
2703
2734
|
const _el$ = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$);
|
|
2704
|
-
$52FdA$solidjsweb.insert(_el$,
|
|
2705
|
-
get each() {
|
|
2706
|
-
return buttons();
|
|
2707
|
-
},
|
|
2708
|
-
children: value => {
|
|
2709
|
-
const is_selected = $52FdA$solidjs.createMemo(() => {
|
|
2710
|
-
var _existing_filter, _existing_filter$data;
|
|
2711
|
-
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_);
|
|
2712
|
-
});
|
|
2713
|
-
return (() => {
|
|
2714
|
-
const _el$2 = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$3),
|
|
2715
|
-
_el$5 = _el$2.firstChild,
|
|
2716
|
-
[_el$6, _co$] = $52FdA$solidjsweb.getNextMarker(_el$5.nextSibling),
|
|
2717
|
-
_el$7 = _el$6.nextSibling,
|
|
2718
|
-
[_el$8, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$7.nextSibling);
|
|
2719
|
-
$52FdA$solidjsweb.addEventListener(_el$2, "click", $52FdA$depictaiutilishared.catchify(() => {
|
|
2720
|
-
const set_filter = existing_filter();
|
|
2721
|
-
const {
|
|
2722
|
-
field: field,
|
|
2723
|
-
op: op
|
|
2724
|
-
} = filter_();
|
|
2725
|
-
const base_object = set_filter ? set_filter : {
|
|
2726
|
-
op: op,
|
|
2727
|
-
field: field
|
|
2728
|
-
};
|
|
2729
|
-
const old_data = base_object.data;
|
|
2730
|
-
const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
|
|
2731
|
-
const new_filter_object = {
|
|
2732
|
-
...base_object,
|
|
2733
|
-
data: new_data
|
|
2734
|
-
};
|
|
2735
|
-
if (!is_selected()) new_filter_object.data.push(value().value_);else new_filter_object.data = new_filter_object.data.filter(v => v !== value().value_);
|
|
2736
|
-
const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
|
|
2737
|
-
set_selected_filters(selected_filters);
|
|
2738
|
-
}), true);
|
|
2739
|
-
$52FdA$solidjsweb.insert(_el$2, () => value().value_, _el$6, _co$);
|
|
2740
|
-
$52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
2741
|
-
get when() {
|
|
2742
|
-
return value().count_ != undefined;
|
|
2743
|
-
},
|
|
2744
|
-
get children() {
|
|
2745
|
-
const _el$3 = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$2),
|
|
2746
|
-
_el$4 = _el$3.firstChild;
|
|
2747
|
-
$52FdA$solidjsweb.insert(_el$4, () => value().count_);
|
|
2748
|
-
return _el$3;
|
|
2749
|
-
}
|
|
2750
|
-
}), _el$8, _co$2);
|
|
2751
|
-
$52FdA$solidjsweb.effect(_p$ => {
|
|
2752
|
-
const _v$ = value().count_ === 0 && !is_selected(),
|
|
2753
|
-
_v$2 = !is_selected(),
|
|
2754
|
-
_v$3 = !!is_selected();
|
|
2755
|
-
_v$ !== _p$._v$ && (_el$2.disabled = _p$._v$ = _v$);
|
|
2756
|
-
_v$2 !== _p$._v$2 && _el$2.classList.toggle("minor", _p$._v$2 = _v$2);
|
|
2757
|
-
_v$3 !== _p$._v$3 && _el$2.classList.toggle("major", _p$._v$3 = _v$3);
|
|
2758
|
-
return _p$;
|
|
2759
|
-
}, {
|
|
2760
|
-
_v$: undefined,
|
|
2761
|
-
_v$2: undefined,
|
|
2762
|
-
_v$3: undefined
|
|
2763
|
-
});
|
|
2764
|
-
$52FdA$solidjsweb.runHydrationEvents();
|
|
2765
|
-
return _el$2;
|
|
2766
|
-
})();
|
|
2767
|
-
}
|
|
2768
|
-
}));
|
|
2735
|
+
$52FdA$solidjsweb.insert(_el$, () => [...shadow_children()]);
|
|
2769
2736
|
return _el$;
|
|
2770
|
-
})();
|
|
2737
|
+
})(); // for getting the smallest possible sizes of all the items
|
|
2738
|
+
$52FdA$solidjs.createEffect(() => {
|
|
2739
|
+
var _container_width_acce;
|
|
2740
|
+
const container_width = (_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce();
|
|
2741
|
+
if (container_width == undefined) return;
|
|
2742
|
+
$cd0e5524f9476f9b$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
|
|
2743
|
+
});
|
|
2744
|
+
return [shadow_grid, $52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
|
|
2745
|
+
get cols_at_size() {
|
|
2746
|
+
return cols_at_size();
|
|
2747
|
+
},
|
|
2748
|
+
grid_spacing: $cd0e5524f9476f9b$var$gap_px + "px",
|
|
2749
|
+
rows: "all",
|
|
2750
|
+
layout: "grid",
|
|
2751
|
+
element_attributes: {
|
|
2752
|
+
class: "checkbox-grid",
|
|
2753
|
+
ref: el => set_container(el)
|
|
2754
|
+
},
|
|
2755
|
+
get children() {
|
|
2756
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
|
|
2757
|
+
get each() {
|
|
2758
|
+
return buttons();
|
|
2759
|
+
},
|
|
2760
|
+
children: value => {
|
|
2761
|
+
const is_selected = $52FdA$solidjs.createMemo(() => {
|
|
2762
|
+
var _existing_filter, _existing_filter$data;
|
|
2763
|
+
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_);
|
|
2764
|
+
});
|
|
2765
|
+
const MakeButton = attributes => (() => {
|
|
2766
|
+
const _el$2 = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$3),
|
|
2767
|
+
_el$5 = _el$2.firstChild,
|
|
2768
|
+
[_el$6, _co$] = $52FdA$solidjsweb.getNextMarker(_el$5.nextSibling),
|
|
2769
|
+
_el$7 = _el$6.nextSibling,
|
|
2770
|
+
[_el$8, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$7.nextSibling);
|
|
2771
|
+
$52FdA$solidjsweb.spread(_el$2, $52FdA$solidjsweb.mergeProps(attributes, {
|
|
2772
|
+
get disabled() {
|
|
2773
|
+
return $52FdA$solidjsweb.memo(() => value().count_ === 0)() && !is_selected();
|
|
2774
|
+
},
|
|
2775
|
+
get classList() {
|
|
2776
|
+
return {
|
|
2777
|
+
minor: !is_selected(),
|
|
2778
|
+
major: is_selected(),
|
|
2779
|
+
"major-minor-transition": true
|
|
2780
|
+
};
|
|
2781
|
+
},
|
|
2782
|
+
get onClick() {
|
|
2783
|
+
return $52FdA$depictaiutilishared.catchify(() => {
|
|
2784
|
+
const set_filter = existing_filter();
|
|
2785
|
+
const {
|
|
2786
|
+
field: field,
|
|
2787
|
+
op: op
|
|
2788
|
+
} = filter_();
|
|
2789
|
+
const base_object = set_filter ? set_filter : {
|
|
2790
|
+
op: op,
|
|
2791
|
+
field: field
|
|
2792
|
+
};
|
|
2793
|
+
const old_data = base_object.data;
|
|
2794
|
+
const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
|
|
2795
|
+
const new_filter_object = {
|
|
2796
|
+
...base_object,
|
|
2797
|
+
data: new_data
|
|
2798
|
+
};
|
|
2799
|
+
if (!is_selected()) new_filter_object.data.push(value().value_);else new_filter_object.data = new_filter_object.data.filter(v => v !== value().value_);
|
|
2800
|
+
const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
|
|
2801
|
+
set_selected_filters(selected_filters);
|
|
2802
|
+
});
|
|
2803
|
+
}
|
|
2804
|
+
}), false, true);
|
|
2805
|
+
$52FdA$solidjsweb.insert(_el$2, () => value().value_, _el$6, _co$);
|
|
2806
|
+
$52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
2807
|
+
get when() {
|
|
2808
|
+
return value().count_ != undefined;
|
|
2809
|
+
},
|
|
2810
|
+
get children() {
|
|
2811
|
+
const _el$3 = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$2),
|
|
2812
|
+
_el$4 = _el$3.firstChild;
|
|
2813
|
+
$52FdA$solidjsweb.insert(_el$4, () => value().count_);
|
|
2814
|
+
return _el$3;
|
|
2815
|
+
}
|
|
2816
|
+
}), _el$8, _co$2);
|
|
2817
|
+
$52FdA$solidjsweb.runHydrationEvents();
|
|
2818
|
+
return _el$2;
|
|
2819
|
+
})();
|
|
2820
|
+
const invisible_size_button = $52FdA$solidjsweb.createComponent(MakeButton, {});
|
|
2821
|
+
const smallest_possible_size = $13671aa5e984acd9$export$9f191182275e9ef(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
|
|
2822
|
+
const sizes_value = $52FdA$solidjs.untrack(sizes_set);
|
|
2823
|
+
const shadow_children_value = $52FdA$solidjs.untrack(shadow_children);
|
|
2824
|
+
sizes_value.add(smallest_possible_size);
|
|
2825
|
+
set_sizes_set(sizes_value);
|
|
2826
|
+
shadow_children_value.add(invisible_size_button);
|
|
2827
|
+
set_shadow_children(shadow_children_value);
|
|
2828
|
+
$52FdA$solidjs.onCleanup(() => {
|
|
2829
|
+
const sizes_value = $52FdA$solidjs.untrack(sizes_set);
|
|
2830
|
+
const shadow_children_value = $52FdA$solidjs.untrack(shadow_children);
|
|
2831
|
+
sizes_value.delete(smallest_possible_size);
|
|
2832
|
+
set_sizes_set(sizes_value);
|
|
2833
|
+
shadow_children_value.delete(invisible_size_button);
|
|
2834
|
+
set_shadow_children(shadow_children_value);
|
|
2835
|
+
});
|
|
2836
|
+
// The actual button that will be visible
|
|
2837
|
+
return $52FdA$solidjsweb.createComponent(MakeButton, {});
|
|
2838
|
+
}
|
|
2839
|
+
});
|
|
2840
|
+
}
|
|
2841
|
+
})];
|
|
2771
2842
|
};
|
|
2772
|
-
|
|
2843
|
+
/**
|
|
2844
|
+
* Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
|
|
2845
|
+
*/
|
|
2846
|
+
function $cd0e5524f9476f9b$var$adjust_sizes(container_width, sizes, set_cols_at_size) {
|
|
2847
|
+
let current_row_index = 0;
|
|
2848
|
+
let current_row_items = [];
|
|
2849
|
+
const column_to_row_result = {};
|
|
2850
|
+
const check_would_fit_evenly = (min_size_of_item, at_number_of_columnns) => {
|
|
2851
|
+
const would_have_even_size = container_width / at_number_of_columnns - (at_number_of_columnns * 2 - 2) * ($cd0e5524f9476f9b$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)
|
|
2852
|
+
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
|
|
2853
|
+
};
|
|
2854
|
+
|
|
2855
|
+
for (const size_item of sizes) {
|
|
2856
|
+
const size = size_item();
|
|
2857
|
+
if (size == undefined) return; // Only do stuff if we know all the sizes
|
|
2858
|
+
const current_row_length = current_row_items.length;
|
|
2859
|
+
const can_add_another_column_initial_val = current_row_length < $cd0e5524f9476f9b$var$max_columns; // allow max 4 items per row
|
|
2860
|
+
let can_add_another_column = can_add_another_column_initial_val;
|
|
2861
|
+
if (can_add_another_column)
|
|
2862
|
+
// can we actually? Since adding another column changes the size of all elements in the row we need to check all of them
|
|
2863
|
+
for (let i = -1; i < current_row_length; i++) {
|
|
2864
|
+
var _ref3;
|
|
2865
|
+
// -1 is for the new item we're adding and every item is guaranteed to exist
|
|
2866
|
+
const size_to_check = (_ref3 = current_row_items[i]) !== null && _ref3 !== void 0 ? _ref3 : size;
|
|
2867
|
+
const would_have_columns = current_row_length + 1; // if we added another column
|
|
2868
|
+
const would_fit_evenly = check_would_fit_evenly(size_to_check, would_have_columns); // see comments in check_would_fit_evenly
|
|
2869
|
+
if (!would_fit_evenly) {
|
|
2870
|
+
can_add_another_column = false;
|
|
2871
|
+
break;
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
if (can_add_another_column) current_row_items.push(size);else {
|
|
2875
|
+
column_to_row_result[++current_row_index] = current_row_length || 1; // overrides is indexed by 1 it seems, therefore ++curent_row_index
|
|
2876
|
+
current_row_items = [size]; // save current item for next row
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2880
|
+
const items_left_to_add = current_row_items.length;
|
|
2881
|
+
if (items_left_to_add) {
|
|
2882
|
+
let num_columns = 1; // We want to have as close to max_columns as possible in the last row
|
|
2883
|
+
let fits = true;
|
|
2884
|
+
do
|
|
2885
|
+
// Check if more columns would fit
|
|
2886
|
+
for (let i = 0; i < items_left_to_add; i++) {
|
|
2887
|
+
const item = current_row_items[i];
|
|
2888
|
+
const would_fit_evenly = check_would_fit_evenly(item, num_columns + 1);
|
|
2889
|
+
if (!would_fit_evenly) {
|
|
2890
|
+
fits = false;
|
|
2891
|
+
break;
|
|
2892
|
+
}
|
|
2893
|
+
} while (fits && ++num_columns < $cd0e5524f9476f9b$var$max_columns);
|
|
2894
|
+
column_to_row_result[++current_row_index] = num_columns; // Add last row that's left after loop finished
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
set_cols_at_size([[1, "0px", "", null, {
|
|
2898
|
+
overrides: column_to_row_result
|
|
2899
|
+
}]]);
|
|
2900
|
+
}
|
|
2773
2901
|
function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
|
|
2774
2902
|
const signal = $52FdA$solidjs.createSignal(false);
|
|
2775
2903
|
$52FdA$solidjs.onCleanup($52FdA$depictaiutilishared.javascript_media_query(media_query, _ref => {
|
|
@@ -2828,7 +2956,7 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
|
|
|
2828
2956
|
});
|
|
2829
2957
|
const rgb_color = $52FdA$solidjs.createMemo(() => $52FdA$depictaiutilishared.hex_to_rgb(hex_color()));
|
|
2830
2958
|
const black_contrast_better = $52FdA$solidjs.createMemo(() => rgb_color() ? $476a3dc36afc1938$var$does_black_contrast_better(rgb_color()) : false);
|
|
2831
|
-
const input_row = $52FdA$solidjsweb.createComponent((0, $
|
|
2959
|
+
const input_row = $52FdA$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
|
|
2832
2960
|
get value_() {
|
|
2833
2961
|
return checkbox().value_;
|
|
2834
2962
|
},
|
package/ES10/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;
|