@depict-ai/ui 2.1.2 → 2.1.4
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 +22 -13
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +22 -13
- package/latest/index.cjs +21 -12
- package/latest/index.d.ts +1 -1
- package/latest/index.js +21 -12
- package/package.json +1 -1
- package/server/ES10/index.cjs +20 -11
- package/server/ES10/index.d.ts +1 -1
- package/server/ES10/index.js +20 -11
- package/server/latest/index.cjs +19 -10
- package/server/latest/index.d.ts +1 -1
- package/server/latest/index.js +19 -10
package/ES10/index.cjs
CHANGED
|
@@ -76,7 +76,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
|
|
|
76
76
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
|
|
77
77
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
78
78
|
/*! Depict.ai search and product listing SDK */
|
|
79
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.
|
|
79
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.4";
|
|
80
80
|
const $a68b73fd7ba0853f$var$fallback_operator = "in";
|
|
81
81
|
const $a68b73fd7ba0853f$var$fallback_token = "";
|
|
82
82
|
const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
|
|
@@ -5106,25 +5106,26 @@ function $830518481649feb1$var$generate_media_queried_declarations(_ref) {
|
|
|
5106
5106
|
} = _ref;
|
|
5107
5107
|
return cols_at_size_.map(options => {
|
|
5108
5108
|
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
5109
|
-
const
|
|
5109
|
+
const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
5110
5110
|
// See comment in else block below
|
|
5111
|
-
const can_use_gap = $830518481649feb1$var$can_use_gap_for_unit(
|
|
5111
|
+
const can_use_gap = override_vertical_spacing_ ? $830518481649feb1$var$can_use_gap_for_unit(override_vertical_spacing_) : $830518481649feb1$var$can_use_gap_for_unit(main_spacing_to_use);
|
|
5112
5112
|
let spacing_styling;
|
|
5113
5113
|
let additional_styling = ""; // outside the media query
|
|
5114
|
-
if (can_use_gap) spacing_styling = "gap:".concat(
|
|
5114
|
+
if (can_use_gap) spacing_styling = "gap:".concat(main_spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
|
|
5115
5115
|
// When using percent units, which our default styling does (because convenient) and our interface relies on (hard to specify different gaps for different screen sizes)
|
|
5116
5116
|
// row gaps in grids are relative to the whole height of the grid, maybe see also https://stackoverflow.com/a/53563865. The issue with that is that as we load more products, the gap grows. Also, it breaks existing integrations.
|
|
5117
5117
|
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
5118
5118
|
// Given that, and that content blocks can be of different width, we have to do some complicated calculations to convert the provided gap, which is in gap of the total container width, to a margin of the individual items.
|
|
5119
|
+
const vertical_spacing_to_use = override_vertical_spacing_ !== null && override_vertical_spacing_ !== void 0 ? override_vertical_spacing_ : main_spacing_to_use;
|
|
5119
5120
|
const width_multiplier = "var(".concat($830518481649feb1$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
|
|
5120
|
-
const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($830518481649feb1$var$strip_percent_unit(
|
|
5121
|
+
const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($830518481649feb1$var$strip_percent_unit(vertical_spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
|
|
5121
5122
|
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
5122
5123
|
const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
|
|
5123
|
-
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($830518481649feb1$var$strip_percent_unit(
|
|
5124
|
+
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($830518481649feb1$var$strip_percent_unit(vertical_spacing_to_use), ")"); // Width of the gaps
|
|
5124
5125
|
const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
|
|
5125
5126
|
// this_item_width needs to be unitless, and since plain css can't do calc(40% / 5%) which would become unitless we need to strip all units in the calculations before
|
|
5126
5127
|
const convert_top_spacing_to_item_width_percentage = spacing => "calc(calc(100 / ".concat(this_item_width, ") * ").concat(spacing, ")"); // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
|
|
5127
|
-
spacing_styling = "column-gap:".concat(
|
|
5128
|
+
spacing_styling = "column-gap:".concat(main_spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
|
|
5128
5129
|
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
5129
5130
|
additional_styling = $52FdA$depictaiutilishared.n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
|
|
5130
5131
|
}
|
|
@@ -5273,6 +5274,9 @@ function $f8f375d6245ffff2$var$remap_blocks_to_index(_ref2) {
|
|
|
5273
5274
|
const cols_showing = n_cols_currently_showing_();
|
|
5274
5275
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
5275
5276
|
const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
5277
|
+
if (!cols_showing)
|
|
5278
|
+
// Nope out of here if we don't know how many columns are showing
|
|
5279
|
+
return content_blocks_by_index;
|
|
5276
5280
|
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
5277
5281
|
// i = row to show at
|
|
5278
5282
|
const block = wrapped_blocks[i];
|
|
@@ -5337,10 +5341,12 @@ function $f8f375d6245ffff2$var$remap_blocks_to_index(_ref2) {
|
|
|
5337
5341
|
function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
5338
5342
|
const get_wrapped_blocks = $52FdA$solidjs.mapArray(() => rendered_content_blocks, block => {
|
|
5339
5343
|
if (!block) return;
|
|
5340
|
-
const
|
|
5344
|
+
const final_span_columns = $52FdA$solidjs.createMemo(() => {
|
|
5341
5345
|
var _max_span_columns;
|
|
5342
5346
|
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
5343
|
-
};
|
|
5347
|
+
});
|
|
5348
|
+
// If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
|
|
5349
|
+
const final_span_rows = $52FdA$solidjs.createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
5344
5350
|
const [rendering_delayed, set_rendering_delayed_] = $52FdA$solidjs.createSignal(true);
|
|
5345
5351
|
const content = $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
5346
5352
|
get when() {
|
|
@@ -5355,10 +5361,10 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
5355
5361
|
}));
|
|
5356
5362
|
$52FdA$solidjsweb.effect(_p$ => {
|
|
5357
5363
|
const _v$ = {
|
|
5358
|
-
[(0, $830518481649feb1$export$c500183c31c2b22e)]:
|
|
5364
|
+
[(0, $830518481649feb1$export$c500183c31c2b22e)]: final_span_columns()
|
|
5359
5365
|
},
|
|
5360
|
-
_v$2 = "span ".concat(
|
|
5361
|
-
_v$3 = "span ".concat(
|
|
5366
|
+
_v$2 = "span ".concat(final_span_columns()),
|
|
5367
|
+
_v$3 = "span ".concat(final_span_rows());
|
|
5362
5368
|
_p$._v$ = $52FdA$solidjsweb.style(_el$, _v$, _p$._v$);
|
|
5363
5369
|
_v$2 !== _p$._v$2 && ((_p$._v$2 = _v$2) != null ? _el$.style.setProperty("grid-column", _v$2) : _el$.style.removeProperty("grid-column"));
|
|
5364
5370
|
_v$3 !== _p$._v$3 && ((_p$._v$3 = _v$3) != null ? _el$.style.setProperty("grid-row", _v$3) : _el$.style.removeProperty("grid-row"));
|
|
@@ -5381,7 +5387,10 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
5381
5387
|
},
|
|
5382
5388
|
get span_columns() {
|
|
5383
5389
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
5384
|
-
return
|
|
5390
|
+
return final_span_columns();
|
|
5391
|
+
},
|
|
5392
|
+
get span_rows() {
|
|
5393
|
+
return final_span_rows();
|
|
5385
5394
|
}
|
|
5386
5395
|
});
|
|
5387
5396
|
});
|
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 { ProductListingRequestV2 } from "@depict-ai/types/api/ProductListingRequestV2";
|
|
10
|
-
export const version = "2.1.
|
|
10
|
+
export const version = "2.1.4";
|
|
11
11
|
/**
|
|
12
12
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
13
13
|
*/
|
package/ES10/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
|
|
|
9
9
|
/*! Depict.ai search and product listing SDK */
|
|
10
10
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
11
11
|
register_es_version("ui", "ES10");
|
|
12
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.
|
|
12
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.4";
|
|
13
13
|
const $2855bffe06ef7a03$var$fallback_operator = "in";
|
|
14
14
|
const $2855bffe06ef7a03$var$fallback_token = "";
|
|
15
15
|
const $2855bffe06ef7a03$var$legacy_filter_prefix = "filter_";
|
|
@@ -5039,25 +5039,26 @@ function $64d94dcaa058dc7b$var$generate_media_queried_declarations(_ref) {
|
|
|
5039
5039
|
} = _ref;
|
|
5040
5040
|
return cols_at_size_.map(options => {
|
|
5041
5041
|
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
5042
|
-
const
|
|
5042
|
+
const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
5043
5043
|
// See comment in else block below
|
|
5044
|
-
const can_use_gap = $64d94dcaa058dc7b$var$can_use_gap_for_unit(
|
|
5044
|
+
const can_use_gap = override_vertical_spacing_ ? $64d94dcaa058dc7b$var$can_use_gap_for_unit(override_vertical_spacing_) : $64d94dcaa058dc7b$var$can_use_gap_for_unit(main_spacing_to_use);
|
|
5045
5045
|
let spacing_styling;
|
|
5046
5046
|
let additional_styling = ""; // outside the media query
|
|
5047
|
-
if (can_use_gap) spacing_styling = "gap:".concat(
|
|
5047
|
+
if (can_use_gap) spacing_styling = "gap:".concat(main_spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
|
|
5048
5048
|
// When using percent units, which our default styling does (because convenient) and our interface relies on (hard to specify different gaps for different screen sizes)
|
|
5049
5049
|
// row gaps in grids are relative to the whole height of the grid, maybe see also https://stackoverflow.com/a/53563865. The issue with that is that as we load more products, the gap grows. Also, it breaks existing integrations.
|
|
5050
5050
|
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
5051
5051
|
// Given that, and that content blocks can be of different width, we have to do some complicated calculations to convert the provided gap, which is in gap of the total container width, to a margin of the individual items.
|
|
5052
|
+
const vertical_spacing_to_use = override_vertical_spacing_ !== null && override_vertical_spacing_ !== void 0 ? override_vertical_spacing_ : main_spacing_to_use;
|
|
5052
5053
|
const width_multiplier = "var(".concat($64d94dcaa058dc7b$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
|
|
5053
|
-
const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($64d94dcaa058dc7b$var$strip_percent_unit(
|
|
5054
|
+
const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($64d94dcaa058dc7b$var$strip_percent_unit(vertical_spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
|
|
5054
5055
|
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
5055
5056
|
const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
|
|
5056
|
-
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($64d94dcaa058dc7b$var$strip_percent_unit(
|
|
5057
|
+
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($64d94dcaa058dc7b$var$strip_percent_unit(vertical_spacing_to_use), ")"); // Width of the gaps
|
|
5057
5058
|
const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
|
|
5058
5059
|
// this_item_width needs to be unitless, and since plain css can't do calc(40% / 5%) which would become unitless we need to strip all units in the calculations before
|
|
5059
5060
|
const convert_top_spacing_to_item_width_percentage = spacing => "calc(calc(100 / ".concat(this_item_width, ") * ").concat(spacing, ")"); // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
|
|
5060
|
-
spacing_styling = "column-gap:".concat(
|
|
5061
|
+
spacing_styling = "column-gap:".concat(main_spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
|
|
5061
5062
|
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
5062
5063
|
additional_styling = $8tj43$n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
|
|
5063
5064
|
}
|
|
@@ -5206,6 +5207,9 @@ function $ff7feae4dddd6073$var$remap_blocks_to_index(_ref2) {
|
|
|
5206
5207
|
const cols_showing = n_cols_currently_showing_();
|
|
5207
5208
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
5208
5209
|
const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
5210
|
+
if (!cols_showing)
|
|
5211
|
+
// Nope out of here if we don't know how many columns are showing
|
|
5212
|
+
return content_blocks_by_index;
|
|
5209
5213
|
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
5210
5214
|
// i = row to show at
|
|
5211
5215
|
const block = wrapped_blocks[i];
|
|
@@ -5270,10 +5274,12 @@ function $ff7feae4dddd6073$var$remap_blocks_to_index(_ref2) {
|
|
|
5270
5274
|
function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
5271
5275
|
const get_wrapped_blocks = $8tj43$mapArray(() => rendered_content_blocks, block => {
|
|
5272
5276
|
if (!block) return;
|
|
5273
|
-
const
|
|
5277
|
+
const final_span_columns = $8tj43$createMemo(() => {
|
|
5274
5278
|
var _max_span_columns;
|
|
5275
5279
|
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
5276
|
-
};
|
|
5280
|
+
});
|
|
5281
|
+
// If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
|
|
5282
|
+
const final_span_rows = $8tj43$createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
5277
5283
|
const [rendering_delayed, set_rendering_delayed_] = $8tj43$createSignal(true);
|
|
5278
5284
|
const content = $8tj43$createComponent((0, $8tj43$Show), {
|
|
5279
5285
|
get when() {
|
|
@@ -5288,10 +5294,10 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
5288
5294
|
}));
|
|
5289
5295
|
$8tj43$effect(_p$ => {
|
|
5290
5296
|
const _v$ = {
|
|
5291
|
-
[(0, $64d94dcaa058dc7b$export$c500183c31c2b22e)]:
|
|
5297
|
+
[(0, $64d94dcaa058dc7b$export$c500183c31c2b22e)]: final_span_columns()
|
|
5292
5298
|
},
|
|
5293
|
-
_v$2 = "span ".concat(
|
|
5294
|
-
_v$3 = "span ".concat(
|
|
5299
|
+
_v$2 = "span ".concat(final_span_columns()),
|
|
5300
|
+
_v$3 = "span ".concat(final_span_rows());
|
|
5295
5301
|
_p$._v$ = $8tj43$style(_el$, _v$, _p$._v$);
|
|
5296
5302
|
_v$2 !== _p$._v$2 && ((_p$._v$2 = _v$2) != null ? _el$.style.setProperty("grid-column", _v$2) : _el$.style.removeProperty("grid-column"));
|
|
5297
5303
|
_v$3 !== _p$._v$3 && ((_p$._v$3 = _v$3) != null ? _el$.style.setProperty("grid-row", _v$3) : _el$.style.removeProperty("grid-row"));
|
|
@@ -5314,7 +5320,10 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
5314
5320
|
},
|
|
5315
5321
|
get span_columns() {
|
|
5316
5322
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
5317
|
-
return
|
|
5323
|
+
return final_span_columns();
|
|
5324
|
+
},
|
|
5325
|
+
get span_rows() {
|
|
5326
|
+
return final_span_rows();
|
|
5318
5327
|
}
|
|
5319
5328
|
});
|
|
5320
5329
|
});
|
package/latest/index.cjs
CHANGED
|
@@ -70,7 +70,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
70
70
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
71
71
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
72
72
|
/*! Depict.ai search and product listing SDK */
|
|
73
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.
|
|
73
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.4";
|
|
74
74
|
const $1ab22f2cd39b3061$var$fallback_operator = "in";
|
|
75
75
|
const $1ab22f2cd39b3061$var$fallback_token = "";
|
|
76
76
|
const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
|
|
@@ -4762,25 +4762,26 @@ function $75777da1687ba3f6$var$generate_media_queried_declarations({
|
|
|
4762
4762
|
}) {
|
|
4763
4763
|
return cols_at_size_.map(options => {
|
|
4764
4764
|
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
4765
|
-
const
|
|
4765
|
+
const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
4766
4766
|
// See comment in else block below
|
|
4767
|
-
const can_use_gap = $75777da1687ba3f6$var$can_use_gap_for_unit(
|
|
4767
|
+
const can_use_gap = override_vertical_spacing_ ? $75777da1687ba3f6$var$can_use_gap_for_unit(override_vertical_spacing_) : $75777da1687ba3f6$var$can_use_gap_for_unit(main_spacing_to_use);
|
|
4768
4768
|
let spacing_styling;
|
|
4769
4769
|
let additional_styling = ""; // outside the media query
|
|
4770
|
-
if (can_use_gap) spacing_styling = `gap:${
|
|
4770
|
+
if (can_use_gap) spacing_styling = `gap:${main_spacing_to_use};${override_vertical_spacing_ ? `row-gap:${override_vertical_spacing_};` : ``}`;else {
|
|
4771
4771
|
// When using percent units, which our default styling does (because convenient) and our interface relies on (hard to specify different gaps for different screen sizes)
|
|
4772
4772
|
// row gaps in grids are relative to the whole height of the grid, maybe see also https://stackoverflow.com/a/53563865. The issue with that is that as we load more products, the gap grows. Also, it breaks existing integrations.
|
|
4773
4773
|
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
4774
4774
|
// Given that, and that content blocks can be of different width, we have to do some complicated calculations to convert the provided gap, which is in gap of the total container width, to a margin of the individual items.
|
|
4775
|
+
const vertical_spacing_to_use = override_vertical_spacing_ ?? main_spacing_to_use;
|
|
4775
4776
|
const width_multiplier = `var(${$75777da1687ba3f6$export$c500183c31c2b22e}, 1)`; // How many cards wide the current item is (needed because content blocks)
|
|
4776
|
-
const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$75777da1687ba3f6$var$strip_percent_unit(
|
|
4777
|
+
const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$75777da1687ba3f6$var$strip_percent_unit(vertical_spacing_to_use)} / 2)) / ${n_cols}))`; // Width of one item in percent of the whole
|
|
4777
4778
|
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
4778
4779
|
const this_item_width_meat = `calc(${one_item_width_exclusing_gaps} * ${width_multiplier})`; // Width of just the card
|
|
4779
|
-
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$75777da1687ba3f6$var$strip_percent_unit(
|
|
4780
|
+
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$75777da1687ba3f6$var$strip_percent_unit(vertical_spacing_to_use)})`; // Width of the gaps
|
|
4780
4781
|
const this_item_width = `calc(${this_item_width_meat} + ${this_item_width_gaps})`; // Width of this item including gaps
|
|
4781
4782
|
// this_item_width needs to be unitless, and since plain css can't do calc(40% / 5%) which would become unitless we need to strip all units in the calculations before
|
|
4782
4783
|
const convert_top_spacing_to_item_width_percentage = spacing => `calc(calc(100 / ${this_item_width}) * ${spacing})`; // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
|
|
4783
|
-
spacing_styling = `column-gap:${
|
|
4784
|
+
spacing_styling = `column-gap:${main_spacing_to_use};`; // Still use gaps in the horizontal direction because that works flawlessly
|
|
4784
4785
|
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
4785
4786
|
additional_styling = $gVhhF$depictaiutilishared.n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
|
|
4786
4787
|
}
|
|
@@ -4919,6 +4920,9 @@ function $d92f338ba8f9da9b$var$remap_blocks_to_index({
|
|
|
4919
4920
|
const cols_showing = n_cols_currently_showing_();
|
|
4920
4921
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
4921
4922
|
const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
4923
|
+
if (!cols_showing)
|
|
4924
|
+
// Nope out of here if we don't know how many columns are showing
|
|
4925
|
+
return content_blocks_by_index;
|
|
4922
4926
|
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
4923
4927
|
// i = row to show at
|
|
4924
4928
|
const block = wrapped_blocks[i];
|
|
@@ -4979,7 +4983,9 @@ function $d92f338ba8f9da9b$var$remap_blocks_to_index({
|
|
|
4979
4983
|
function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
4980
4984
|
const get_wrapped_blocks = $gVhhF$solidjs.mapArray(() => rendered_content_blocks, block => {
|
|
4981
4985
|
if (!block) return;
|
|
4982
|
-
const
|
|
4986
|
+
const final_span_columns = $gVhhF$solidjs.createMemo(() => Math.min(block.span_columns, max_span_columns() ?? Infinity));
|
|
4987
|
+
// If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
|
|
4988
|
+
const final_span_rows = $gVhhF$solidjs.createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
4983
4989
|
const [rendering_delayed, set_rendering_delayed_] = $gVhhF$solidjs.createSignal(true);
|
|
4984
4990
|
const content = $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
4985
4991
|
get when() {
|
|
@@ -4994,10 +5000,10 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4994
5000
|
}));
|
|
4995
5001
|
$gVhhF$solidjsweb.effect(_p$ => {
|
|
4996
5002
|
const _v$ = {
|
|
4997
|
-
[(0, $75777da1687ba3f6$export$c500183c31c2b22e)]:
|
|
5003
|
+
[(0, $75777da1687ba3f6$export$c500183c31c2b22e)]: final_span_columns()
|
|
4998
5004
|
},
|
|
4999
|
-
_v$2 = `span ${
|
|
5000
|
-
_v$3 = `span ${
|
|
5005
|
+
_v$2 = `span ${final_span_columns()}`,
|
|
5006
|
+
_v$3 = `span ${final_span_rows()}`;
|
|
5001
5007
|
_p$._v$ = $gVhhF$solidjsweb.style(_el$, _v$, _p$._v$);
|
|
5002
5008
|
_v$2 !== _p$._v$2 && ((_p$._v$2 = _v$2) != null ? _el$.style.setProperty("grid-column", _v$2) : _el$.style.removeProperty("grid-column"));
|
|
5003
5009
|
_v$3 !== _p$._v$3 && ((_p$._v$3 = _v$3) != null ? _el$.style.setProperty("grid-row", _v$3) : _el$.style.removeProperty("grid-row"));
|
|
@@ -5020,7 +5026,10 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
5020
5026
|
},
|
|
5021
5027
|
get span_columns() {
|
|
5022
5028
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
5023
|
-
return
|
|
5029
|
+
return final_span_columns();
|
|
5030
|
+
},
|
|
5031
|
+
get span_rows() {
|
|
5032
|
+
return final_span_rows();
|
|
5024
5033
|
}
|
|
5025
5034
|
});
|
|
5026
5035
|
});
|
package/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 { ProductListingRequestV2 } from "@depict-ai/types/api/ProductListingRequestV2";
|
|
10
|
-
export const version = "2.1.
|
|
10
|
+
export const version = "2.1.4";
|
|
11
11
|
/**
|
|
12
12
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
13
13
|
*/
|
package/latest/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from
|
|
|
6
6
|
/*! Depict.ai search and product listing SDK */
|
|
7
7
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
8
8
|
register_es_version("ui", "latest");
|
|
9
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "2.1.
|
|
9
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "2.1.4";
|
|
10
10
|
const $4147651646da990a$var$fallback_operator = "in";
|
|
11
11
|
const $4147651646da990a$var$fallback_token = "";
|
|
12
12
|
const $4147651646da990a$var$legacy_filter_prefix = "filter_";
|
|
@@ -4698,25 +4698,26 @@ function $6dee9211e57ac31a$var$generate_media_queried_declarations({
|
|
|
4698
4698
|
}) {
|
|
4699
4699
|
return cols_at_size_.map(options => {
|
|
4700
4700
|
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
4701
|
-
const
|
|
4701
|
+
const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
4702
4702
|
// See comment in else block below
|
|
4703
|
-
const can_use_gap = $6dee9211e57ac31a$var$can_use_gap_for_unit(
|
|
4703
|
+
const can_use_gap = override_vertical_spacing_ ? $6dee9211e57ac31a$var$can_use_gap_for_unit(override_vertical_spacing_) : $6dee9211e57ac31a$var$can_use_gap_for_unit(main_spacing_to_use);
|
|
4704
4704
|
let spacing_styling;
|
|
4705
4705
|
let additional_styling = ""; // outside the media query
|
|
4706
|
-
if (can_use_gap) spacing_styling = `gap:${
|
|
4706
|
+
if (can_use_gap) spacing_styling = `gap:${main_spacing_to_use};${override_vertical_spacing_ ? `row-gap:${override_vertical_spacing_};` : ``}`;else {
|
|
4707
4707
|
// When using percent units, which our default styling does (because convenient) and our interface relies on (hard to specify different gaps for different screen sizes)
|
|
4708
4708
|
// row gaps in grids are relative to the whole height of the grid, maybe see also https://stackoverflow.com/a/53563865. The issue with that is that as we load more products, the gap grows. Also, it breaks existing integrations.
|
|
4709
4709
|
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
4710
4710
|
// Given that, and that content blocks can be of different width, we have to do some complicated calculations to convert the provided gap, which is in gap of the total container width, to a margin of the individual items.
|
|
4711
|
+
const vertical_spacing_to_use = override_vertical_spacing_ ?? main_spacing_to_use;
|
|
4711
4712
|
const width_multiplier = `var(${$6dee9211e57ac31a$export$c500183c31c2b22e}, 1)`; // How many cards wide the current item is (needed because content blocks)
|
|
4712
|
-
const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$6dee9211e57ac31a$var$strip_percent_unit(
|
|
4713
|
+
const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$6dee9211e57ac31a$var$strip_percent_unit(vertical_spacing_to_use)} / 2)) / ${n_cols}))`; // Width of one item in percent of the whole
|
|
4713
4714
|
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
4714
4715
|
const this_item_width_meat = `calc(${one_item_width_exclusing_gaps} * ${width_multiplier})`; // Width of just the card
|
|
4715
|
-
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$6dee9211e57ac31a$var$strip_percent_unit(
|
|
4716
|
+
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$6dee9211e57ac31a$var$strip_percent_unit(vertical_spacing_to_use)})`; // Width of the gaps
|
|
4716
4717
|
const this_item_width = `calc(${this_item_width_meat} + ${this_item_width_gaps})`; // Width of this item including gaps
|
|
4717
4718
|
// this_item_width needs to be unitless, and since plain css can't do calc(40% / 5%) which would become unitless we need to strip all units in the calculations before
|
|
4718
4719
|
const convert_top_spacing_to_item_width_percentage = spacing => `calc(calc(100 / ${this_item_width}) * ${spacing})`; // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
|
|
4719
|
-
spacing_styling = `column-gap:${
|
|
4720
|
+
spacing_styling = `column-gap:${main_spacing_to_use};`; // Still use gaps in the horizontal direction because that works flawlessly
|
|
4720
4721
|
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
4721
4722
|
additional_styling = $9HbP8$n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
|
|
4722
4723
|
}
|
|
@@ -4855,6 +4856,9 @@ function $e7a7eb102ddc0c79$var$remap_blocks_to_index({
|
|
|
4855
4856
|
const cols_showing = n_cols_currently_showing_();
|
|
4856
4857
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
4857
4858
|
const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
4859
|
+
if (!cols_showing)
|
|
4860
|
+
// Nope out of here if we don't know how many columns are showing
|
|
4861
|
+
return content_blocks_by_index;
|
|
4858
4862
|
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
4859
4863
|
// i = row to show at
|
|
4860
4864
|
const block = wrapped_blocks[i];
|
|
@@ -4915,7 +4919,9 @@ function $e7a7eb102ddc0c79$var$remap_blocks_to_index({
|
|
|
4915
4919
|
function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
4916
4920
|
const get_wrapped_blocks = $9HbP8$mapArray(() => rendered_content_blocks, block => {
|
|
4917
4921
|
if (!block) return;
|
|
4918
|
-
const
|
|
4922
|
+
const final_span_columns = $9HbP8$createMemo(() => Math.min(block.span_columns, max_span_columns() ?? Infinity));
|
|
4923
|
+
// If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
|
|
4924
|
+
const final_span_rows = $9HbP8$createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
4919
4925
|
const [rendering_delayed, set_rendering_delayed_] = $9HbP8$createSignal(true);
|
|
4920
4926
|
const content = $9HbP8$createComponent((0, $9HbP8$Show), {
|
|
4921
4927
|
get when() {
|
|
@@ -4930,10 +4936,10 @@ function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4930
4936
|
}));
|
|
4931
4937
|
$9HbP8$effect(_p$ => {
|
|
4932
4938
|
const _v$ = {
|
|
4933
|
-
[(0, $6dee9211e57ac31a$export$c500183c31c2b22e)]:
|
|
4939
|
+
[(0, $6dee9211e57ac31a$export$c500183c31c2b22e)]: final_span_columns()
|
|
4934
4940
|
},
|
|
4935
|
-
_v$2 = `span ${
|
|
4936
|
-
_v$3 = `span ${
|
|
4941
|
+
_v$2 = `span ${final_span_columns()}`,
|
|
4942
|
+
_v$3 = `span ${final_span_rows()}`;
|
|
4937
4943
|
_p$._v$ = $9HbP8$style(_el$, _v$, _p$._v$);
|
|
4938
4944
|
_v$2 !== _p$._v$2 && ((_p$._v$2 = _v$2) != null ? _el$.style.setProperty("grid-column", _v$2) : _el$.style.removeProperty("grid-column"));
|
|
4939
4945
|
_v$3 !== _p$._v$3 && ((_p$._v$3 = _v$3) != null ? _el$.style.setProperty("grid-row", _v$3) : _el$.style.removeProperty("grid-row"));
|
|
@@ -4956,7 +4962,10 @@ function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4956
4962
|
},
|
|
4957
4963
|
get span_columns() {
|
|
4958
4964
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4959
|
-
return
|
|
4965
|
+
return final_span_columns();
|
|
4966
|
+
},
|
|
4967
|
+
get span_rows() {
|
|
4968
|
+
return final_span_rows();
|
|
4960
4969
|
}
|
|
4961
4970
|
});
|
|
4962
4971
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/ui",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
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",
|
package/server/ES10/index.cjs
CHANGED
|
@@ -76,7 +76,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
|
|
|
76
76
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
|
|
77
77
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
78
78
|
/*! Depict.ai search and product listing SDK */
|
|
79
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.
|
|
79
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.4";
|
|
80
80
|
const $a68b73fd7ba0853f$var$fallback_operator = "in";
|
|
81
81
|
const $a68b73fd7ba0853f$var$fallback_token = "";
|
|
82
82
|
const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
|
|
@@ -4181,25 +4181,26 @@ function $830518481649feb1$var$generate_media_queried_declarations(_ref) {
|
|
|
4181
4181
|
} = _ref;
|
|
4182
4182
|
return cols_at_size_.map(options => {
|
|
4183
4183
|
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
4184
|
-
const
|
|
4184
|
+
const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
4185
4185
|
// See comment in else block below
|
|
4186
|
-
const can_use_gap = $830518481649feb1$var$can_use_gap_for_unit(
|
|
4186
|
+
const can_use_gap = override_vertical_spacing_ ? $830518481649feb1$var$can_use_gap_for_unit(override_vertical_spacing_) : $830518481649feb1$var$can_use_gap_for_unit(main_spacing_to_use);
|
|
4187
4187
|
let spacing_styling;
|
|
4188
4188
|
let additional_styling = ""; // outside the media query
|
|
4189
|
-
if (can_use_gap) spacing_styling = "gap:".concat(
|
|
4189
|
+
if (can_use_gap) spacing_styling = "gap:".concat(main_spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
|
|
4190
4190
|
// When using percent units, which our default styling does (because convenient) and our interface relies on (hard to specify different gaps for different screen sizes)
|
|
4191
4191
|
// row gaps in grids are relative to the whole height of the grid, maybe see also https://stackoverflow.com/a/53563865. The issue with that is that as we load more products, the gap grows. Also, it breaks existing integrations.
|
|
4192
4192
|
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
4193
4193
|
// Given that, and that content blocks can be of different width, we have to do some complicated calculations to convert the provided gap, which is in gap of the total container width, to a margin of the individual items.
|
|
4194
|
+
const vertical_spacing_to_use = override_vertical_spacing_ !== null && override_vertical_spacing_ !== void 0 ? override_vertical_spacing_ : main_spacing_to_use;
|
|
4194
4195
|
const width_multiplier = "var(".concat($830518481649feb1$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
|
|
4195
|
-
const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($830518481649feb1$var$strip_percent_unit(
|
|
4196
|
+
const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($830518481649feb1$var$strip_percent_unit(vertical_spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
|
|
4196
4197
|
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
4197
4198
|
const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
|
|
4198
|
-
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($830518481649feb1$var$strip_percent_unit(
|
|
4199
|
+
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($830518481649feb1$var$strip_percent_unit(vertical_spacing_to_use), ")"); // Width of the gaps
|
|
4199
4200
|
const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
|
|
4200
4201
|
// this_item_width needs to be unitless, and since plain css can't do calc(40% / 5%) which would become unitless we need to strip all units in the calculations before
|
|
4201
4202
|
const convert_top_spacing_to_item_width_percentage = spacing => "calc(calc(100 / ".concat(this_item_width, ") * ").concat(spacing, ")"); // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
|
|
4202
|
-
spacing_styling = "column-gap:".concat(
|
|
4203
|
+
spacing_styling = "column-gap:".concat(main_spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
|
|
4203
4204
|
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
4204
4205
|
additional_styling = $3hooq$depictaiutilishared.n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
|
|
4205
4206
|
}
|
|
@@ -4348,6 +4349,9 @@ function $f8f375d6245ffff2$var$remap_blocks_to_index(_ref2) {
|
|
|
4348
4349
|
const cols_showing = n_cols_currently_showing_();
|
|
4349
4350
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
4350
4351
|
const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
4352
|
+
if (!cols_showing)
|
|
4353
|
+
// Nope out of here if we don't know how many columns are showing
|
|
4354
|
+
return content_blocks_by_index;
|
|
4351
4355
|
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
4352
4356
|
// i = row to show at
|
|
4353
4357
|
const block = wrapped_blocks[i];
|
|
@@ -4412,17 +4416,19 @@ function $f8f375d6245ffff2$var$remap_blocks_to_index(_ref2) {
|
|
|
4412
4416
|
function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
4413
4417
|
const get_wrapped_blocks = $3hooq$solidjs.mapArray(() => rendered_content_blocks, block => {
|
|
4414
4418
|
if (!block) return;
|
|
4415
|
-
const
|
|
4419
|
+
const final_span_columns = $3hooq$solidjs.createMemo(() => {
|
|
4416
4420
|
var _max_span_columns;
|
|
4417
4421
|
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
4418
|
-
};
|
|
4422
|
+
});
|
|
4423
|
+
// If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
|
|
4424
|
+
const final_span_rows = $3hooq$solidjs.createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
4419
4425
|
const [rendering_delayed, set_rendering_delayed_] = $3hooq$solidjs.createSignal(true);
|
|
4420
4426
|
const content = $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
4421
4427
|
get when() {
|
|
4422
4428
|
return !rendering_delayed();
|
|
4423
4429
|
},
|
|
4424
4430
|
get children() {
|
|
4425
|
-
return $3hooq$solidjsweb.ssr($f8f375d6245ffff2$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "grid-column:" + "span ".concat($3hooq$solidjsweb.escape(
|
|
4431
|
+
return $3hooq$solidjsweb.ssr($f8f375d6245ffff2$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "grid-column:" + "span ".concat($3hooq$solidjsweb.escape(final_span_columns(), true)) + (";grid-row:" + "span ".concat($3hooq$solidjsweb.escape(final_span_rows(), true))) + (";spans_columns_variable_name:" + $3hooq$solidjsweb.escape(final_span_columns(), true)), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent($f8f375d6245ffff2$var$RenderContent, {
|
|
4426
4432
|
get content() {
|
|
4427
4433
|
return block.content;
|
|
4428
4434
|
}
|
|
@@ -4439,7 +4445,10 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4439
4445
|
},
|
|
4440
4446
|
get span_columns() {
|
|
4441
4447
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4442
|
-
return
|
|
4448
|
+
return final_span_columns();
|
|
4449
|
+
},
|
|
4450
|
+
get span_rows() {
|
|
4451
|
+
return final_span_rows();
|
|
4443
4452
|
}
|
|
4444
4453
|
});
|
|
4445
4454
|
});
|
package/server/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 { ProductListingRequestV2 } from "@depict-ai/types/api/ProductListingRequestV2";
|
|
10
|
-
export const version = "2.1.
|
|
10
|
+
export const version = "2.1.4";
|
|
11
11
|
/**
|
|
12
12
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
13
13
|
*/
|
package/server/ES10/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createStore as $b8hua$createStore, reconcile as $b8hua$reconcile } from
|
|
|
9
9
|
/*! Depict.ai search and product listing SDK */
|
|
10
10
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
11
11
|
register_es_version("ui", "ES10");
|
|
12
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.
|
|
12
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.4";
|
|
13
13
|
const $2855bffe06ef7a03$var$fallback_operator = "in";
|
|
14
14
|
const $2855bffe06ef7a03$var$fallback_token = "";
|
|
15
15
|
const $2855bffe06ef7a03$var$legacy_filter_prefix = "filter_";
|
|
@@ -4114,25 +4114,26 @@ function $64d94dcaa058dc7b$var$generate_media_queried_declarations(_ref) {
|
|
|
4114
4114
|
} = _ref;
|
|
4115
4115
|
return cols_at_size_.map(options => {
|
|
4116
4116
|
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
4117
|
-
const
|
|
4117
|
+
const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
4118
4118
|
// See comment in else block below
|
|
4119
|
-
const can_use_gap = $64d94dcaa058dc7b$var$can_use_gap_for_unit(
|
|
4119
|
+
const can_use_gap = override_vertical_spacing_ ? $64d94dcaa058dc7b$var$can_use_gap_for_unit(override_vertical_spacing_) : $64d94dcaa058dc7b$var$can_use_gap_for_unit(main_spacing_to_use);
|
|
4120
4120
|
let spacing_styling;
|
|
4121
4121
|
let additional_styling = ""; // outside the media query
|
|
4122
|
-
if (can_use_gap) spacing_styling = "gap:".concat(
|
|
4122
|
+
if (can_use_gap) spacing_styling = "gap:".concat(main_spacing_to_use, ";").concat(override_vertical_spacing_ ? "row-gap:".concat(override_vertical_spacing_, ";") : "");else {
|
|
4123
4123
|
// When using percent units, which our default styling does (because convenient) and our interface relies on (hard to specify different gaps for different screen sizes)
|
|
4124
4124
|
// row gaps in grids are relative to the whole height of the grid, maybe see also https://stackoverflow.com/a/53563865. The issue with that is that as we load more products, the gap grows. Also, it breaks existing integrations.
|
|
4125
4125
|
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
4126
4126
|
// Given that, and that content blocks can be of different width, we have to do some complicated calculations to convert the provided gap, which is in gap of the total container width, to a margin of the individual items.
|
|
4127
|
+
const vertical_spacing_to_use = override_vertical_spacing_ !== null && override_vertical_spacing_ !== void 0 ? override_vertical_spacing_ : main_spacing_to_use;
|
|
4127
4128
|
const width_multiplier = "var(".concat($64d94dcaa058dc7b$export$c500183c31c2b22e, ", 1)"); // How many cards wide the current item is (needed because content blocks)
|
|
4128
|
-
const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($64d94dcaa058dc7b$var$strip_percent_unit(
|
|
4129
|
+
const one_item_width_exclusing_gaps = "calc(calc(100 / ".concat(n_cols, ") - calc(calc(").concat(n_cols * 2 - 2, " * calc(").concat($64d94dcaa058dc7b$var$strip_percent_unit(vertical_spacing_to_use), " / 2)) / ").concat(n_cols, "))"); // Width of one item in percent of the whole
|
|
4129
4130
|
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
4130
4131
|
const this_item_width_meat = "calc(".concat(one_item_width_exclusing_gaps, " * ").concat(width_multiplier, ")"); // Width of just the card
|
|
4131
|
-
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($64d94dcaa058dc7b$var$strip_percent_unit(
|
|
4132
|
+
const this_item_width_gaps = "calc(calc(".concat(width_multiplier, " - 1) * ").concat($64d94dcaa058dc7b$var$strip_percent_unit(vertical_spacing_to_use), ")"); // Width of the gaps
|
|
4132
4133
|
const this_item_width = "calc(".concat(this_item_width_meat, " + ").concat(this_item_width_gaps, ")"); // Width of this item including gaps
|
|
4133
4134
|
// this_item_width needs to be unitless, and since plain css can't do calc(40% / 5%) which would become unitless we need to strip all units in the calculations before
|
|
4134
4135
|
const convert_top_spacing_to_item_width_percentage = spacing => "calc(calc(100 / ".concat(this_item_width, ") * ").concat(spacing, ")"); // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
|
|
4135
|
-
spacing_styling = "column-gap:".concat(
|
|
4136
|
+
spacing_styling = "column-gap:".concat(main_spacing_to_use, ";"); // Still use gaps in the horizontal direction because that works flawlessly
|
|
4136
4137
|
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
4137
4138
|
additional_styling = $b8hua$n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
|
|
4138
4139
|
}
|
|
@@ -4281,6 +4282,9 @@ function $ff7feae4dddd6073$var$remap_blocks_to_index(_ref2) {
|
|
|
4281
4282
|
const cols_showing = n_cols_currently_showing_();
|
|
4282
4283
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
4283
4284
|
const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
4285
|
+
if (!cols_showing)
|
|
4286
|
+
// Nope out of here if we don't know how many columns are showing
|
|
4287
|
+
return content_blocks_by_index;
|
|
4284
4288
|
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
4285
4289
|
// i = row to show at
|
|
4286
4290
|
const block = wrapped_blocks[i];
|
|
@@ -4345,17 +4349,19 @@ function $ff7feae4dddd6073$var$remap_blocks_to_index(_ref2) {
|
|
|
4345
4349
|
function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
4346
4350
|
const get_wrapped_blocks = $b8hua$mapArray(() => rendered_content_blocks, block => {
|
|
4347
4351
|
if (!block) return;
|
|
4348
|
-
const
|
|
4352
|
+
const final_span_columns = $b8hua$createMemo(() => {
|
|
4349
4353
|
var _max_span_columns;
|
|
4350
4354
|
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
4351
|
-
};
|
|
4355
|
+
});
|
|
4356
|
+
// If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
|
|
4357
|
+
const final_span_rows = $b8hua$createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
4352
4358
|
const [rendering_delayed, set_rendering_delayed_] = $b8hua$createSignal(true);
|
|
4353
4359
|
const content = $b8hua$createComponent((0, $b8hua$Show), {
|
|
4354
4360
|
get when() {
|
|
4355
4361
|
return !rendering_delayed();
|
|
4356
4362
|
},
|
|
4357
4363
|
get children() {
|
|
4358
|
-
return $b8hua$ssr($ff7feae4dddd6073$var$_tmpl$, $b8hua$ssrHydrationKey(), "grid-column:" + "span ".concat($b8hua$escape(
|
|
4364
|
+
return $b8hua$ssr($ff7feae4dddd6073$var$_tmpl$, $b8hua$ssrHydrationKey(), "grid-column:" + "span ".concat($b8hua$escape(final_span_columns(), true)) + (";grid-row:" + "span ".concat($b8hua$escape(final_span_rows(), true))) + (";spans_columns_variable_name:" + $b8hua$escape(final_span_columns(), true)), $b8hua$escape($b8hua$createComponent($ff7feae4dddd6073$var$RenderContent, {
|
|
4359
4365
|
get content() {
|
|
4360
4366
|
return block.content;
|
|
4361
4367
|
}
|
|
@@ -4372,7 +4378,10 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4372
4378
|
},
|
|
4373
4379
|
get span_columns() {
|
|
4374
4380
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4375
|
-
return
|
|
4381
|
+
return final_span_columns();
|
|
4382
|
+
},
|
|
4383
|
+
get span_rows() {
|
|
4384
|
+
return final_span_rows();
|
|
4376
4385
|
}
|
|
4377
4386
|
});
|
|
4378
4387
|
});
|
package/server/latest/index.cjs
CHANGED
|
@@ -70,7 +70,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
70
70
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
71
71
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
72
72
|
/*! Depict.ai search and product listing SDK */
|
|
73
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.
|
|
73
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.4";
|
|
74
74
|
const $1ab22f2cd39b3061$var$fallback_operator = "in";
|
|
75
75
|
const $1ab22f2cd39b3061$var$fallback_token = "";
|
|
76
76
|
const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
|
|
@@ -3874,25 +3874,26 @@ function $75777da1687ba3f6$var$generate_media_queried_declarations({
|
|
|
3874
3874
|
}) {
|
|
3875
3875
|
return cols_at_size_.map(options => {
|
|
3876
3876
|
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
3877
|
-
const
|
|
3877
|
+
const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
3878
3878
|
// See comment in else block below
|
|
3879
|
-
const can_use_gap = $75777da1687ba3f6$var$can_use_gap_for_unit(
|
|
3879
|
+
const can_use_gap = override_vertical_spacing_ ? $75777da1687ba3f6$var$can_use_gap_for_unit(override_vertical_spacing_) : $75777da1687ba3f6$var$can_use_gap_for_unit(main_spacing_to_use);
|
|
3880
3880
|
let spacing_styling;
|
|
3881
3881
|
let additional_styling = ""; // outside the media query
|
|
3882
|
-
if (can_use_gap) spacing_styling = `gap:${
|
|
3882
|
+
if (can_use_gap) spacing_styling = `gap:${main_spacing_to_use};${override_vertical_spacing_ ? `row-gap:${override_vertical_spacing_};` : ``}`;else {
|
|
3883
3883
|
// When using percent units, which our default styling does (because convenient) and our interface relies on (hard to specify different gaps for different screen sizes)
|
|
3884
3884
|
// row gaps in grids are relative to the whole height of the grid, maybe see also https://stackoverflow.com/a/53563865. The issue with that is that as we load more products, the gap grows. Also, it breaks existing integrations.
|
|
3885
3885
|
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
3886
3886
|
// Given that, and that content blocks can be of different width, we have to do some complicated calculations to convert the provided gap, which is in gap of the total container width, to a margin of the individual items.
|
|
3887
|
+
const vertical_spacing_to_use = override_vertical_spacing_ ?? main_spacing_to_use;
|
|
3887
3888
|
const width_multiplier = `var(${$75777da1687ba3f6$export$c500183c31c2b22e}, 1)`; // How many cards wide the current item is (needed because content blocks)
|
|
3888
|
-
const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$75777da1687ba3f6$var$strip_percent_unit(
|
|
3889
|
+
const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$75777da1687ba3f6$var$strip_percent_unit(vertical_spacing_to_use)} / 2)) / ${n_cols}))`; // Width of one item in percent of the whole
|
|
3889
3890
|
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
3890
3891
|
const this_item_width_meat = `calc(${one_item_width_exclusing_gaps} * ${width_multiplier})`; // Width of just the card
|
|
3891
|
-
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$75777da1687ba3f6$var$strip_percent_unit(
|
|
3892
|
+
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$75777da1687ba3f6$var$strip_percent_unit(vertical_spacing_to_use)})`; // Width of the gaps
|
|
3892
3893
|
const this_item_width = `calc(${this_item_width_meat} + ${this_item_width_gaps})`; // Width of this item including gaps
|
|
3893
3894
|
// this_item_width needs to be unitless, and since plain css can't do calc(40% / 5%) which would become unitless we need to strip all units in the calculations before
|
|
3894
3895
|
const convert_top_spacing_to_item_width_percentage = spacing => `calc(calc(100 / ${this_item_width}) * ${spacing})`; // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
|
|
3895
|
-
spacing_styling = `column-gap:${
|
|
3896
|
+
spacing_styling = `column-gap:${main_spacing_to_use};`; // Still use gaps in the horizontal direction because that works flawlessly
|
|
3896
3897
|
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
3897
3898
|
additional_styling = $5vyXB$depictaiutilishared.n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
|
|
3898
3899
|
}
|
|
@@ -4031,6 +4032,9 @@ function $d92f338ba8f9da9b$var$remap_blocks_to_index({
|
|
|
4031
4032
|
const cols_showing = n_cols_currently_showing_();
|
|
4032
4033
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
4033
4034
|
const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
4035
|
+
if (!cols_showing)
|
|
4036
|
+
// Nope out of here if we don't know how many columns are showing
|
|
4037
|
+
return content_blocks_by_index;
|
|
4034
4038
|
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
4035
4039
|
// i = row to show at
|
|
4036
4040
|
const block = wrapped_blocks[i];
|
|
@@ -4091,14 +4095,16 @@ function $d92f338ba8f9da9b$var$remap_blocks_to_index({
|
|
|
4091
4095
|
function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
4092
4096
|
const get_wrapped_blocks = $5vyXB$solidjs.mapArray(() => rendered_content_blocks, block => {
|
|
4093
4097
|
if (!block) return;
|
|
4094
|
-
const
|
|
4098
|
+
const final_span_columns = $5vyXB$solidjs.createMemo(() => Math.min(block.span_columns, max_span_columns() ?? Infinity));
|
|
4099
|
+
// If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
|
|
4100
|
+
const final_span_rows = $5vyXB$solidjs.createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
4095
4101
|
const [rendering_delayed, set_rendering_delayed_] = $5vyXB$solidjs.createSignal(true);
|
|
4096
4102
|
const content = $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
4097
4103
|
get when() {
|
|
4098
4104
|
return !rendering_delayed();
|
|
4099
4105
|
},
|
|
4100
4106
|
get children() {
|
|
4101
|
-
return $5vyXB$solidjsweb.ssr($d92f338ba8f9da9b$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), "grid-column:" + `span ${$5vyXB$solidjsweb.escape(
|
|
4107
|
+
return $5vyXB$solidjsweb.ssr($d92f338ba8f9da9b$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), "grid-column:" + `span ${$5vyXB$solidjsweb.escape(final_span_columns(), true)}` + (";grid-row:" + `span ${$5vyXB$solidjsweb.escape(final_span_rows(), true)}`) + (";spans_columns_variable_name:" + $5vyXB$solidjsweb.escape(final_span_columns(), true)), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent($d92f338ba8f9da9b$var$RenderContent, {
|
|
4102
4108
|
get content() {
|
|
4103
4109
|
return block.content;
|
|
4104
4110
|
}
|
|
@@ -4115,7 +4121,10 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4115
4121
|
},
|
|
4116
4122
|
get span_columns() {
|
|
4117
4123
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4118
|
-
return
|
|
4124
|
+
return final_span_columns();
|
|
4125
|
+
},
|
|
4126
|
+
get span_rows() {
|
|
4127
|
+
return final_span_rows();
|
|
4119
4128
|
}
|
|
4120
4129
|
});
|
|
4121
4130
|
});
|
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 { ProductListingRequestV2 } from "@depict-ai/types/api/ProductListingRequestV2";
|
|
10
|
-
export const version = "2.1.
|
|
10
|
+
export const version = "2.1.4";
|
|
11
11
|
/**
|
|
12
12
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
13
13
|
*/
|
package/server/latest/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { createStore as $i7OB2$createStore, reconcile as $i7OB2$reconcile } from
|
|
|
6
6
|
/*! Depict.ai search and product listing SDK */
|
|
7
7
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
8
8
|
register_es_version("ui", "latest");
|
|
9
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "2.1.
|
|
9
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "2.1.4";
|
|
10
10
|
const $4147651646da990a$var$fallback_operator = "in";
|
|
11
11
|
const $4147651646da990a$var$fallback_token = "";
|
|
12
12
|
const $4147651646da990a$var$legacy_filter_prefix = "filter_";
|
|
@@ -3810,25 +3810,26 @@ function $6dee9211e57ac31a$var$generate_media_queried_declarations({
|
|
|
3810
3810
|
}) {
|
|
3811
3811
|
return cols_at_size_.map(options => {
|
|
3812
3812
|
const [n_cols, min, max, grid_spacing_for_size] = options;
|
|
3813
|
-
const
|
|
3813
|
+
const main_spacing_to_use = grid_spacing_for_size || default_grid_spacing_text;
|
|
3814
3814
|
// See comment in else block below
|
|
3815
|
-
const can_use_gap = $6dee9211e57ac31a$var$can_use_gap_for_unit(
|
|
3815
|
+
const can_use_gap = override_vertical_spacing_ ? $6dee9211e57ac31a$var$can_use_gap_for_unit(override_vertical_spacing_) : $6dee9211e57ac31a$var$can_use_gap_for_unit(main_spacing_to_use);
|
|
3816
3816
|
let spacing_styling;
|
|
3817
3817
|
let additional_styling = ""; // outside the media query
|
|
3818
|
-
if (can_use_gap) spacing_styling = `gap:${
|
|
3818
|
+
if (can_use_gap) spacing_styling = `gap:${main_spacing_to_use};${override_vertical_spacing_ ? `row-gap:${override_vertical_spacing_};` : ``}`;else {
|
|
3819
3819
|
// When using percent units, which our default styling does (because convenient) and our interface relies on (hard to specify different gaps for different screen sizes)
|
|
3820
3820
|
// row gaps in grids are relative to the whole height of the grid, maybe see also https://stackoverflow.com/a/53563865. The issue with that is that as we load more products, the gap grows. Also, it breaks existing integrations.
|
|
3821
3821
|
// Logical thought: use margins for the vertical spacing. But margins in grids are apparently relative to the size of the individual items in grids.
|
|
3822
3822
|
// Given that, and that content blocks can be of different width, we have to do some complicated calculations to convert the provided gap, which is in gap of the total container width, to a margin of the individual items.
|
|
3823
|
+
const vertical_spacing_to_use = override_vertical_spacing_ ?? main_spacing_to_use;
|
|
3823
3824
|
const width_multiplier = `var(${$6dee9211e57ac31a$export$c500183c31c2b22e}, 1)`; // How many cards wide the current item is (needed because content blocks)
|
|
3824
|
-
const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$6dee9211e57ac31a$var$strip_percent_unit(
|
|
3825
|
+
const one_item_width_exclusing_gaps = `calc(calc(100 / ${n_cols}) - calc(calc(${n_cols * 2 - 2} * calc(${$6dee9211e57ac31a$var$strip_percent_unit(vertical_spacing_to_use)} / 2)) / ${n_cols}))`; // Width of one item in percent of the whole
|
|
3825
3826
|
// Equation from layout.tsx, also used in CheckboxGrid. Needs half spacing for some reason
|
|
3826
3827
|
const this_item_width_meat = `calc(${one_item_width_exclusing_gaps} * ${width_multiplier})`; // Width of just the card
|
|
3827
|
-
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$6dee9211e57ac31a$var$strip_percent_unit(
|
|
3828
|
+
const this_item_width_gaps = `calc(calc(${width_multiplier} - 1) * ${$6dee9211e57ac31a$var$strip_percent_unit(vertical_spacing_to_use)})`; // Width of the gaps
|
|
3828
3829
|
const this_item_width = `calc(${this_item_width_meat} + ${this_item_width_gaps})`; // Width of this item including gaps
|
|
3829
3830
|
// this_item_width needs to be unitless, and since plain css can't do calc(40% / 5%) which would become unitless we need to strip all units in the calculations before
|
|
3830
3831
|
const convert_top_spacing_to_item_width_percentage = spacing => `calc(calc(100 / ${this_item_width}) * ${spacing})`; // Now finally we can convert the desired spacing to a percentage of this individual item's width (including gaps that would be there but aren't because content blocks span them)
|
|
3831
|
-
spacing_styling = `column-gap:${
|
|
3832
|
+
spacing_styling = `column-gap:${main_spacing_to_use};`; // Still use gaps in the horizontal direction because that works flawlessly
|
|
3832
3833
|
// Re-use old layout code to get the correct :nth-child declarations for the top margins
|
|
3833
3834
|
additional_styling = $i7OB2$n_col_styling_with_dist(container_selector_ + ">", convert_top_spacing_to_item_width_percentage(default_grid_spacing_text), [[n_cols, min, max, grid_spacing_for_size ? convert_top_spacing_to_item_width_percentage(grid_spacing_for_size) : null]], "grid", override_vertical_spacing_ ? convert_top_spacing_to_item_width_percentage(override_vertical_spacing_) : override_vertical_spacing_, top_row_shortened_by_);
|
|
3834
3835
|
}
|
|
@@ -3967,6 +3968,9 @@ function $e7a7eb102ddc0c79$var$remap_blocks_to_index({
|
|
|
3967
3968
|
const cols_showing = n_cols_currently_showing_();
|
|
3968
3969
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
3969
3970
|
const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
3971
|
+
if (!cols_showing)
|
|
3972
|
+
// Nope out of here if we don't know how many columns are showing
|
|
3973
|
+
return content_blocks_by_index;
|
|
3970
3974
|
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
3971
3975
|
// i = row to show at
|
|
3972
3976
|
const block = wrapped_blocks[i];
|
|
@@ -4027,14 +4031,16 @@ function $e7a7eb102ddc0c79$var$remap_blocks_to_index({
|
|
|
4027
4031
|
function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
4028
4032
|
const get_wrapped_blocks = $i7OB2$mapArray(() => rendered_content_blocks, block => {
|
|
4029
4033
|
if (!block) return;
|
|
4030
|
-
const
|
|
4034
|
+
const final_span_columns = $i7OB2$createMemo(() => Math.min(block.span_columns, max_span_columns() ?? Infinity));
|
|
4035
|
+
// If the item spans an entire row, limit the height to 1 row since there's no concept of "rows" if there are no products beside the block
|
|
4036
|
+
const final_span_rows = $i7OB2$createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
4031
4037
|
const [rendering_delayed, set_rendering_delayed_] = $i7OB2$createSignal(true);
|
|
4032
4038
|
const content = $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
4033
4039
|
get when() {
|
|
4034
4040
|
return !rendering_delayed();
|
|
4035
4041
|
},
|
|
4036
4042
|
get children() {
|
|
4037
|
-
return $i7OB2$ssr($e7a7eb102ddc0c79$var$_tmpl$, $i7OB2$ssrHydrationKey(), "grid-column:" + `span ${$i7OB2$escape(
|
|
4043
|
+
return $i7OB2$ssr($e7a7eb102ddc0c79$var$_tmpl$, $i7OB2$ssrHydrationKey(), "grid-column:" + `span ${$i7OB2$escape(final_span_columns(), true)}` + (";grid-row:" + `span ${$i7OB2$escape(final_span_rows(), true)}`) + (";spans_columns_variable_name:" + $i7OB2$escape(final_span_columns(), true)), $i7OB2$escape($i7OB2$createComponent($e7a7eb102ddc0c79$var$RenderContent, {
|
|
4038
4044
|
get content() {
|
|
4039
4045
|
return block.content;
|
|
4040
4046
|
}
|
|
@@ -4051,7 +4057,10 @@ function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4051
4057
|
},
|
|
4052
4058
|
get span_columns() {
|
|
4053
4059
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
4054
|
-
return
|
|
4060
|
+
return final_span_columns();
|
|
4061
|
+
},
|
|
4062
|
+
get span_rows() {
|
|
4063
|
+
return final_span_rows();
|
|
4055
4064
|
}
|
|
4056
4065
|
});
|
|
4057
4066
|
});
|