@depict-ai/ui 4.7.30 → 4.7.32
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 +132 -25
- package/ES10/index.d.ts +12 -4
- package/ES10/index.js +132 -25
- package/latest/index.cjs +126 -24
- package/latest/index.d.ts +12 -4
- package/latest/index.js +126 -24
- package/package.json +1 -1
- package/server/ES10/index.cjs +103 -20
- package/server/ES10/index.d.ts +12 -4
- package/server/ES10/index.js +103 -20
- package/server/latest/index.cjs +97 -19
- package/server/latest/index.d.ts +12 -4
- package/server/latest/index.js +97 -19
package/latest/index.cjs
CHANGED
|
@@ -105,7 +105,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
|
|
|
105
105
|
$parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
|
|
106
106
|
$parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
|
|
107
107
|
/*! Depict.ai search and product listing SDK */
|
|
108
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.7.
|
|
108
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.7.32";
|
|
109
109
|
function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
|
|
110
110
|
const signal = $gVhhF$solidjs.createSignal(false);
|
|
111
111
|
$gVhhF$solidjs.onCleanup($gVhhF$depictaiutilishared.javascript_media_query(media_query, ({
|
|
@@ -360,20 +360,22 @@ function $d92f338ba8f9da9b$export$791ef57e62e21c3f({
|
|
|
360
360
|
return $gVhhF$solidjs.createMemo(() => $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
361
361
|
wrapped_blocks_: get_wrapped_blocks_(),
|
|
362
362
|
n_cols_currently_showing_: n_cols_currently_showing_()
|
|
363
|
-
}));
|
|
363
|
+
}).content_blocks_by_index_);
|
|
364
364
|
}
|
|
365
365
|
function $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
366
366
|
wrapped_blocks_: wrapped_blocks_,
|
|
367
367
|
n_cols_currently_showing_: n_cols_currently_showing_
|
|
368
368
|
}) {
|
|
369
369
|
// This computation should be quite cheap since it just moves around things into an array
|
|
370
|
-
const
|
|
370
|
+
const content_blocks_by_index_ = [];
|
|
371
371
|
const constructed_block_arrays = new WeakSet();
|
|
372
372
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
373
|
-
const
|
|
373
|
+
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
|
|
374
374
|
if (!n_cols_currently_showing_)
|
|
375
375
|
// Nope out of here if we don't know how many columns are showing
|
|
376
|
-
return
|
|
376
|
+
return {
|
|
377
|
+
content_blocks_by_index_: content_blocks_by_index_
|
|
378
|
+
};
|
|
377
379
|
for (let i = 0; i < wrapped_blocks_.length; i++) {
|
|
378
380
|
// i = row to show at
|
|
379
381
|
const block = wrapped_blocks_[i];
|
|
@@ -390,22 +392,22 @@ function $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
|
390
392
|
// Calculate displacement of us by content blocks above us
|
|
391
393
|
let displacement_by_added_blocks = 0;
|
|
392
394
|
for (let j = 0; j < i; j++) {
|
|
393
|
-
const row =
|
|
395
|
+
const row = displaced_products_[j];
|
|
394
396
|
if (row === undefined) continue; // there were no blocks in this row
|
|
395
397
|
let displaced_items_in_row;
|
|
396
398
|
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
397
399
|
displaced_items_in_row = row.filter(item => item).length;
|
|
398
|
-
|
|
400
|
+
displaced_products_[j] = displaced_items_in_row;
|
|
399
401
|
}
|
|
400
402
|
displacement_by_added_blocks += displaced_items_in_row;
|
|
401
403
|
}
|
|
402
404
|
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
403
|
-
for (let j = 0; j < index_of_us_in_row; j++) if (
|
|
405
|
+
for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products_[i]?.[j])
|
|
404
406
|
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
405
407
|
displacement_by_added_blocks++;
|
|
406
408
|
// Add block to output array at the correct index
|
|
407
409
|
const final_target_index = target_index - displacement_by_added_blocks;
|
|
408
|
-
const existing_block =
|
|
410
|
+
const existing_block = content_blocks_by_index_[final_target_index];
|
|
409
411
|
const block_content = block.content;
|
|
410
412
|
// If two blocks want to exist at the same location (can happen, for example if one block wants to be at the end of a row and the other one at the start of the next row) add an array with both
|
|
411
413
|
if (existing_block) {
|
|
@@ -414,16 +416,19 @@ function $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
|
414
416
|
existing_block.push(block_content);else {
|
|
415
417
|
const array = [existing_block, block_content];
|
|
416
418
|
constructed_block_arrays.add(array);
|
|
417
|
-
|
|
419
|
+
content_blocks_by_index_[final_target_index] = array;
|
|
418
420
|
}
|
|
419
|
-
} else
|
|
421
|
+
} else content_blocks_by_index_[final_target_index] = block_content;
|
|
420
422
|
// Update displacement
|
|
421
423
|
for (let j = 0; j < span_rows; j++) {
|
|
422
|
-
const row =
|
|
424
|
+
const row = displaced_products_[i + j] ||= [];
|
|
423
425
|
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
424
426
|
}
|
|
425
427
|
}
|
|
426
|
-
return
|
|
428
|
+
return {
|
|
429
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
430
|
+
displaced_products_: displaced_products_
|
|
431
|
+
};
|
|
427
432
|
}
|
|
428
433
|
/**
|
|
429
434
|
* Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
|
|
@@ -449,19 +454,22 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
449
454
|
}
|
|
450
455
|
}));
|
|
451
456
|
$gVhhF$solidjsweb.effect(_p$ => {
|
|
452
|
-
var _v$ =
|
|
457
|
+
var _v$ = !!(final_span_columns() === max_span_columns()),
|
|
458
|
+
_v$2 = {
|
|
453
459
|
[(0, $75777da1687ba3f6$export$c500183c31c2b22e)]: final_span_columns()
|
|
454
460
|
},
|
|
455
|
-
_v$
|
|
456
|
-
_v$
|
|
457
|
-
_p$.e
|
|
458
|
-
|
|
459
|
-
_v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-
|
|
461
|
+
_v$3 = `span ${final_span_columns()}`,
|
|
462
|
+
_v$4 = `span ${final_span_rows()}`;
|
|
463
|
+
_v$ !== _p$.e && _el$.classList.toggle("spans-whole-row", _p$.e = _v$);
|
|
464
|
+
_p$.t = $gVhhF$solidjsweb.style(_el$, _v$2, _p$.t);
|
|
465
|
+
_v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-column", _v$3) : _el$.style.removeProperty("grid-column"));
|
|
466
|
+
_v$4 !== _p$.o && ((_p$.o = _v$4) != null ? _el$.style.setProperty("grid-row", _v$4) : _el$.style.removeProperty("grid-row"));
|
|
460
467
|
return _p$;
|
|
461
468
|
}, {
|
|
462
469
|
e: undefined,
|
|
463
470
|
t: undefined,
|
|
464
|
-
a: undefined
|
|
471
|
+
a: undefined,
|
|
472
|
+
o: undefined
|
|
465
473
|
});
|
|
466
474
|
return _el$;
|
|
467
475
|
}
|
|
@@ -10224,7 +10232,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
10224
10232
|
breadcrumbs: [],
|
|
10225
10233
|
quick_links: [],
|
|
10226
10234
|
image_urls: [],
|
|
10227
|
-
failed: true
|
|
10235
|
+
failed: true,
|
|
10236
|
+
content_blocks: []
|
|
10228
10237
|
}),
|
|
10229
10238
|
method_: "GET"
|
|
10230
10239
|
});
|
|
@@ -10488,7 +10497,8 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
10488
10497
|
// Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
|
|
10489
10498
|
local_filter_cache: [],
|
|
10490
10499
|
expanded_hierarchical_filters: [],
|
|
10491
|
-
scroll_restoration_data: []
|
|
10500
|
+
scroll_restoration_data: [],
|
|
10501
|
+
history_content_blocks: []
|
|
10492
10502
|
}),
|
|
10493
10503
|
router_: this.#router,
|
|
10494
10504
|
prefix_: "category" + unique_instance_key_for_state + "_"
|
|
@@ -14881,6 +14891,94 @@ function $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, listing_id, i18n_) {
|
|
|
14881
14891
|
$gVhhF$solidjs.onCleanup(disconnect);
|
|
14882
14892
|
}
|
|
14883
14893
|
$gVhhF$solidjsweb.delegateEvents(["click"]);
|
|
14894
|
+
var $32c662f618f5d80d$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<a class=d-standard-content-wrapper><video loop class=d-standard-content>`);
|
|
14895
|
+
function $32c662f618f5d80d$export$780a853d15174484({
|
|
14896
|
+
contentBlock_: {
|
|
14897
|
+
content: {
|
|
14898
|
+
link: link,
|
|
14899
|
+
type: type,
|
|
14900
|
+
url: mediaUrl
|
|
14901
|
+
}
|
|
14902
|
+
},
|
|
14903
|
+
router_: router_
|
|
14904
|
+
}) {
|
|
14905
|
+
if (type === "image") {
|
|
14906
|
+
const [wrapperSize, setWrapperSize] = $gVhhF$solidjs.createSignal();
|
|
14907
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjsweb.Dynamic), $gVhhF$solidjsweb.mergeProps({
|
|
14908
|
+
component: link ? "a" : "div",
|
|
14909
|
+
"class": "d-standard-content-wrapper",
|
|
14910
|
+
ref: el => setWrapperSize(() => $19950faaac026e09$export$e6fffe67d4cdd848(el)),
|
|
14911
|
+
get onClick() {
|
|
14912
|
+
return $gVhhF$depictaiutilisharedlatest.catchify(ev => link && router_.navigate_.go_to_({
|
|
14913
|
+
new_url_: link,
|
|
14914
|
+
is_replace_: false,
|
|
14915
|
+
event_: ev
|
|
14916
|
+
}));
|
|
14917
|
+
}
|
|
14918
|
+
}, link && {
|
|
14919
|
+
href: link
|
|
14920
|
+
}, {
|
|
14921
|
+
get children() {
|
|
14922
|
+
return $gVhhF$solidjsweb.createComponent((0, $19950faaac026e09$export$6e5611bc7e57e477), {
|
|
14923
|
+
get size() {
|
|
14924
|
+
return $gVhhF$solidjs.createMemo(() => wrapperSize()?.() || 0);
|
|
14925
|
+
},
|
|
14926
|
+
src: mediaUrl,
|
|
14927
|
+
"class": "d-standard-content"
|
|
14928
|
+
});
|
|
14929
|
+
}
|
|
14930
|
+
}));
|
|
14931
|
+
}
|
|
14932
|
+
if (type === "video") {
|
|
14933
|
+
const pageVisible = $55cbacb79d3e0cea$export$54299a3c81f5425();
|
|
14934
|
+
return (() => {
|
|
14935
|
+
var _el$ = $gVhhF$solidjsweb.getNextElement($32c662f618f5d80d$var$_tmpl$),
|
|
14936
|
+
_el$2 = _el$.firstChild;
|
|
14937
|
+
$gVhhF$solidjsweb.addEventListener(_el$, "click", $gVhhF$depictaiutilisharedlatest.catchify(ev => router_.navigate_.go_to_({
|
|
14938
|
+
new_url_: link,
|
|
14939
|
+
is_replace_: false,
|
|
14940
|
+
event_: ev
|
|
14941
|
+
})), true);
|
|
14942
|
+
$gVhhF$solidjsweb.setAttribute(_el$, "href", link);
|
|
14943
|
+
$gVhhF$solidjsweb.use(element => $gVhhF$solidjs.createEffect(() => {
|
|
14944
|
+
if (pageVisible()) element.play().catch(e => $gVhhF$depictaiutilishared.dlog("Failed to play", e));else element.pause();
|
|
14945
|
+
}), _el$2);
|
|
14946
|
+
$gVhhF$solidjsweb.setAttribute(_el$2, "src", mediaUrl);
|
|
14947
|
+
$gVhhF$solidjsweb.setProperty(_el$2, "controls", false);
|
|
14948
|
+
$gVhhF$solidjsweb.setProperty(_el$2, "muted", true);
|
|
14949
|
+
$gVhhF$solidjsweb.setProperty(_el$2, "autoplay", true);
|
|
14950
|
+
$gVhhF$solidjsweb.setProperty(_el$2, "playsinline", true);
|
|
14951
|
+
$gVhhF$solidjsweb.runHydrationEvents();
|
|
14952
|
+
return _el$;
|
|
14953
|
+
})();
|
|
14954
|
+
}
|
|
14955
|
+
}
|
|
14956
|
+
$gVhhF$solidjsweb.delegateEvents(["click"]);
|
|
14957
|
+
function $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
|
|
14958
|
+
const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
|
|
14959
|
+
$gVhhF$solidjs.createEffect(() => {
|
|
14960
|
+
const serverContentBlock = plp_meta()?.content_blocks;
|
|
14961
|
+
if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(historyContentBlocks())) setHistoryContentBlocks(serverContentBlock);
|
|
14962
|
+
});
|
|
14963
|
+
const contentBlocksByRow = $gVhhF$solidjs.createMemo(() => {
|
|
14964
|
+
if (content_blocks_by_row_()) return content_blocks_by_row_();
|
|
14965
|
+
const content = [];
|
|
14966
|
+
historyContentBlocks().forEach(row => {
|
|
14967
|
+
const contentBlock = {
|
|
14968
|
+
span_columns: row.span_columns,
|
|
14969
|
+
span_rows: row.span_rows,
|
|
14970
|
+
position: row.position,
|
|
14971
|
+
content: () => $gVhhF$solidjsweb.createComponent((0, $32c662f618f5d80d$export$780a853d15174484), {
|
|
14972
|
+
contentBlock_: row,
|
|
14973
|
+
router_: router_
|
|
14974
|
+
})
|
|
14975
|
+
};
|
|
14976
|
+
content[row.row] = contentBlock;
|
|
14977
|
+
});
|
|
14978
|
+
return content;
|
|
14979
|
+
});
|
|
14980
|
+
return contentBlocksByRow;
|
|
14981
|
+
}
|
|
14884
14982
|
var $840d88a04b2d22a7$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=product-count><!$><!/> <!$><!/>`),
|
|
14885
14983
|
$840d88a04b2d22a7$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div>`),
|
|
14886
14984
|
$840d88a04b2d22a7$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=filter-results-for-one-row><!$><!/><!$><!/>`),
|
|
@@ -14908,6 +15006,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
14908
15006
|
show_breadcrumbs_: show_breadcrumbs_,
|
|
14909
15007
|
layout_options_: layout_options_,
|
|
14910
15008
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
15009
|
+
history_content_blocks_: history_content_blocks_,
|
|
14911
15010
|
product_card_template_: product_card_template_,
|
|
14912
15011
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
14913
15012
|
sorting_query_param_: sorting_query_param_,
|
|
@@ -14976,6 +15075,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
14976
15075
|
}));
|
|
14977
15076
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
14978
15077
|
const [plp_meta] = $gVhhF$solidjs.createResource(meta_query_base, $gVhhF$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
|
|
15078
|
+
const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
|
|
14979
15079
|
const available_sortings_ = $gVhhF$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
|
|
14980
15080
|
...sort,
|
|
14981
15081
|
order: sort.order ?? "desc"
|
|
@@ -15236,7 +15336,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
15236
15336
|
product_card_template_: product_card_template_,
|
|
15237
15337
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
15238
15338
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
15239
|
-
content_blocks_by_row_:
|
|
15339
|
+
content_blocks_by_row_: contentBlocksByRow,
|
|
15240
15340
|
ConfiguredScrollStatus_: ConfiguredScrollStatus_,
|
|
15241
15341
|
id_currently_querying_for_: id_to_query_for_,
|
|
15242
15342
|
no_results_options_: {
|
|
@@ -15330,7 +15430,8 @@ function $14f289047713d67a$export$e2bf8ce7779e827e(props) {
|
|
|
15330
15430
|
sorting_open: category_sorting_open_,
|
|
15331
15431
|
expanded_filters: expanded_filters_,
|
|
15332
15432
|
expanded_hierarchical_filters: expanded_hierarchical_filters_,
|
|
15333
|
-
scroll_restoration_data: scroll_restoration_data_
|
|
15433
|
+
scroll_restoration_data: scroll_restoration_data_,
|
|
15434
|
+
history_content_blocks: history_content_blocks_
|
|
15334
15435
|
} = depict_category.historyStateSignals_;
|
|
15335
15436
|
const {
|
|
15336
15437
|
current_sorting_: current_sorting_,
|
|
@@ -15376,6 +15477,7 @@ function $14f289047713d67a$export$e2bf8ce7779e827e(props) {
|
|
|
15376
15477
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
15377
15478
|
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
15378
15479
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
15480
|
+
history_content_blocks_: history_content_blocks_,
|
|
15379
15481
|
layout_options_: $gVhhF$solidjs.createMemo(() => ({
|
|
15380
15482
|
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
|
|
15381
15483
|
...grid_spacing_override(),
|
package/latest/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { report, Amazing_Slider, Display, useExpandingContainer, ColsAtSize, Ele
|
|
|
3
3
|
import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
|
|
4
4
|
import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
|
|
5
5
|
import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
6
|
-
import { ProductListing, GetListingResponse } from "@depict-ai/types/api/GetListingResponse";
|
|
6
|
+
import { ProductListing, GetListingResponse, ContentBlock as _ContentBlock1 } from "@depict-ai/types/api/GetListingResponse";
|
|
7
7
|
import { ProductListingResponseV3, SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/ProductListingResponseV3";
|
|
8
8
|
import { SearchSuggestionsRequestV3 } from "@depict-ai/types/api/SearchSuggestionsRequestV3";
|
|
9
9
|
import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequestV3";
|
|
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
|
|
13
13
|
import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
|
|
14
|
-
export const version = "4.7.
|
|
14
|
+
export const version = "4.7.32";
|
|
15
15
|
/**
|
|
16
16
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
17
17
|
*/
|
|
@@ -93,7 +93,8 @@ export type ContentBlocksByRow = (undefined | ContentBlock)[];
|
|
|
93
93
|
/**
|
|
94
94
|
* Does pure calculations where to put each of the finished wrapped content blocks in the elements in the grid (input is by row). You need to cap span_columns of the blocks to the columns available before passing them to this function.
|
|
95
95
|
* Also used in the portal in react.
|
|
96
|
-
* @returns an array where index is index of the blocks in the "displays array" and value is the content block (elements) to show at that index
|
|
96
|
+
* @returns content_blocks_by_index_: an array where index is index of the blocks in the "displays array" and value is the content block (elements) to show at that index.
|
|
97
|
+
* displaced_products_: internal state that can be used to figure out if there's parts of a content block on a row, see the comment inside this function
|
|
97
98
|
*/
|
|
98
99
|
export function remap_blocks_to_index<T = () => JSX.Element | Promise<JSX.Element>>({
|
|
99
100
|
wrapped_blocks_,
|
|
@@ -106,7 +107,13 @@ export function remap_blocks_to_index<T = () => JSX.Element | Promise<JSX.Elemen
|
|
|
106
107
|
content: T;
|
|
107
108
|
})[];
|
|
108
109
|
n_cols_currently_showing_: number | null;
|
|
109
|
-
}):
|
|
110
|
+
}): {
|
|
111
|
+
content_blocks_by_index_: (Awaited<T> | T[])[];
|
|
112
|
+
readonly displaced_products_?: undefined;
|
|
113
|
+
} | {
|
|
114
|
+
readonly content_blocks_by_index_: (Awaited<T> | T[])[];
|
|
115
|
+
readonly displaced_products_: (number | (true | undefined)[])[];
|
|
116
|
+
};
|
|
110
117
|
/**
|
|
111
118
|
* Returns a set containing the element where every element currently touching the screen started touching it.
|
|
112
119
|
*/
|
|
@@ -1327,6 +1334,7 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
|
|
|
1327
1334
|
expanded_: boolean;
|
|
1328
1335
|
}[]>;
|
|
1329
1336
|
scroll_restoration_data: Signal<ScrollRestorationData>;
|
|
1337
|
+
history_content_blocks: Signal<_ContentBlock1[]>;
|
|
1330
1338
|
};
|
|
1331
1339
|
/**
|
|
1332
1340
|
* Signal representing the currently selected filters. Will update to always reflect the state of the current URL. Calling the setter triggers a navigation (replaceState) to an updated URL.
|
package/latest/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { dlog as $9HbP8$dlog, catchify as $9HbP8$catchify, ListenableSet as $9Hb
|
|
|
7
7
|
/*! Depict.ai search and product listing SDK */
|
|
8
8
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
9
9
|
register_es_version("ui", "latest");
|
|
10
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "4.7.
|
|
10
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "4.7.32";
|
|
11
11
|
function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
|
|
12
12
|
const signal = $9HbP8$createSignal(false);
|
|
13
13
|
$9HbP8$onCleanup($9HbP8$javascript_media_query(media_query, ({
|
|
@@ -262,20 +262,22 @@ function $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
|
|
|
262
262
|
return $9HbP8$createMemo(() => $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
|
|
263
263
|
wrapped_blocks_: get_wrapped_blocks_(),
|
|
264
264
|
n_cols_currently_showing_: n_cols_currently_showing_()
|
|
265
|
-
}));
|
|
265
|
+
}).content_blocks_by_index_);
|
|
266
266
|
}
|
|
267
267
|
function $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
|
|
268
268
|
wrapped_blocks_: wrapped_blocks_,
|
|
269
269
|
n_cols_currently_showing_: n_cols_currently_showing_
|
|
270
270
|
}) {
|
|
271
271
|
// This computation should be quite cheap since it just moves around things into an array
|
|
272
|
-
const
|
|
272
|
+
const content_blocks_by_index_ = [];
|
|
273
273
|
const constructed_block_arrays = new WeakSet();
|
|
274
274
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
275
|
-
const
|
|
275
|
+
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
|
|
276
276
|
if (!n_cols_currently_showing_)
|
|
277
277
|
// Nope out of here if we don't know how many columns are showing
|
|
278
|
-
return
|
|
278
|
+
return {
|
|
279
|
+
content_blocks_by_index_: content_blocks_by_index_
|
|
280
|
+
};
|
|
279
281
|
for (let i = 0; i < wrapped_blocks_.length; i++) {
|
|
280
282
|
// i = row to show at
|
|
281
283
|
const block = wrapped_blocks_[i];
|
|
@@ -292,22 +294,22 @@ function $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
|
|
|
292
294
|
// Calculate displacement of us by content blocks above us
|
|
293
295
|
let displacement_by_added_blocks = 0;
|
|
294
296
|
for (let j = 0; j < i; j++) {
|
|
295
|
-
const row =
|
|
297
|
+
const row = displaced_products_[j];
|
|
296
298
|
if (row === undefined) continue; // there were no blocks in this row
|
|
297
299
|
let displaced_items_in_row;
|
|
298
300
|
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
299
301
|
displaced_items_in_row = row.filter(item => item).length;
|
|
300
|
-
|
|
302
|
+
displaced_products_[j] = displaced_items_in_row;
|
|
301
303
|
}
|
|
302
304
|
displacement_by_added_blocks += displaced_items_in_row;
|
|
303
305
|
}
|
|
304
306
|
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
305
|
-
for (let j = 0; j < index_of_us_in_row; j++) if (
|
|
307
|
+
for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products_[i]?.[j])
|
|
306
308
|
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
307
309
|
displacement_by_added_blocks++;
|
|
308
310
|
// Add block to output array at the correct index
|
|
309
311
|
const final_target_index = target_index - displacement_by_added_blocks;
|
|
310
|
-
const existing_block =
|
|
312
|
+
const existing_block = content_blocks_by_index_[final_target_index];
|
|
311
313
|
const block_content = block.content;
|
|
312
314
|
// If two blocks want to exist at the same location (can happen, for example if one block wants to be at the end of a row and the other one at the start of the next row) add an array with both
|
|
313
315
|
if (existing_block) {
|
|
@@ -316,16 +318,19 @@ function $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
|
|
|
316
318
|
existing_block.push(block_content);else {
|
|
317
319
|
const array = [existing_block, block_content];
|
|
318
320
|
constructed_block_arrays.add(array);
|
|
319
|
-
|
|
321
|
+
content_blocks_by_index_[final_target_index] = array;
|
|
320
322
|
}
|
|
321
|
-
} else
|
|
323
|
+
} else content_blocks_by_index_[final_target_index] = block_content;
|
|
322
324
|
// Update displacement
|
|
323
325
|
for (let j = 0; j < span_rows; j++) {
|
|
324
|
-
const row =
|
|
326
|
+
const row = displaced_products_[i + j] ||= [];
|
|
325
327
|
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
326
328
|
}
|
|
327
329
|
}
|
|
328
|
-
return
|
|
330
|
+
return {
|
|
331
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
332
|
+
displaced_products_: displaced_products_
|
|
333
|
+
};
|
|
329
334
|
}
|
|
330
335
|
/**
|
|
331
336
|
* Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
|
|
@@ -351,19 +356,22 @@ function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
351
356
|
}
|
|
352
357
|
}));
|
|
353
358
|
$9HbP8$effect(_p$ => {
|
|
354
|
-
var _v$ =
|
|
359
|
+
var _v$ = !!(final_span_columns() === max_span_columns()),
|
|
360
|
+
_v$2 = {
|
|
355
361
|
[(0, $6dee9211e57ac31a$export$c500183c31c2b22e)]: final_span_columns()
|
|
356
362
|
},
|
|
357
|
-
_v$
|
|
358
|
-
_v$
|
|
359
|
-
_p$.e
|
|
360
|
-
|
|
361
|
-
_v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-
|
|
363
|
+
_v$3 = `span ${final_span_columns()}`,
|
|
364
|
+
_v$4 = `span ${final_span_rows()}`;
|
|
365
|
+
_v$ !== _p$.e && _el$.classList.toggle("spans-whole-row", _p$.e = _v$);
|
|
366
|
+
_p$.t = $9HbP8$style(_el$, _v$2, _p$.t);
|
|
367
|
+
_v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-column", _v$3) : _el$.style.removeProperty("grid-column"));
|
|
368
|
+
_v$4 !== _p$.o && ((_p$.o = _v$4) != null ? _el$.style.setProperty("grid-row", _v$4) : _el$.style.removeProperty("grid-row"));
|
|
362
369
|
return _p$;
|
|
363
370
|
}, {
|
|
364
371
|
e: undefined,
|
|
365
372
|
t: undefined,
|
|
366
|
-
a: undefined
|
|
373
|
+
a: undefined,
|
|
374
|
+
o: undefined
|
|
367
375
|
});
|
|
368
376
|
return _el$;
|
|
369
377
|
}
|
|
@@ -10126,7 +10134,8 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
10126
10134
|
breadcrumbs: [],
|
|
10127
10135
|
quick_links: [],
|
|
10128
10136
|
image_urls: [],
|
|
10129
|
-
failed: true
|
|
10137
|
+
failed: true,
|
|
10138
|
+
content_blocks: []
|
|
10130
10139
|
}),
|
|
10131
10140
|
method_: "GET"
|
|
10132
10141
|
});
|
|
@@ -10390,7 +10399,8 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
|
|
|
10390
10399
|
// Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
|
|
10391
10400
|
local_filter_cache: [],
|
|
10392
10401
|
expanded_hierarchical_filters: [],
|
|
10393
|
-
scroll_restoration_data: []
|
|
10402
|
+
scroll_restoration_data: [],
|
|
10403
|
+
history_content_blocks: []
|
|
10394
10404
|
}),
|
|
10395
10405
|
router_: this.#router,
|
|
10396
10406
|
prefix_: "category" + unique_instance_key_for_state + "_"
|
|
@@ -14783,6 +14793,94 @@ function $cc6f5b69378cd164$export$7af06a63c5a976c9(el, listing_id, i18n_) {
|
|
|
14783
14793
|
$9HbP8$onCleanup(disconnect);
|
|
14784
14794
|
}
|
|
14785
14795
|
$9HbP8$delegateEvents(["click"]);
|
|
14796
|
+
var $f916989c4b1be9f7$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<a class=d-standard-content-wrapper><video loop class=d-standard-content>`);
|
|
14797
|
+
function $f916989c4b1be9f7$export$780a853d15174484({
|
|
14798
|
+
contentBlock_: {
|
|
14799
|
+
content: {
|
|
14800
|
+
link: link,
|
|
14801
|
+
type: type,
|
|
14802
|
+
url: mediaUrl
|
|
14803
|
+
}
|
|
14804
|
+
},
|
|
14805
|
+
router_: router_
|
|
14806
|
+
}) {
|
|
14807
|
+
if (type === "image") {
|
|
14808
|
+
const [wrapperSize, setWrapperSize] = $9HbP8$createSignal();
|
|
14809
|
+
return $9HbP8$createComponent((0, $9HbP8$Dynamic), $9HbP8$mergeProps1({
|
|
14810
|
+
component: link ? "a" : "div",
|
|
14811
|
+
"class": "d-standard-content-wrapper",
|
|
14812
|
+
ref: el => setWrapperSize(() => $e8ffe11ed01df0fe$export$e6fffe67d4cdd848(el)),
|
|
14813
|
+
get onClick() {
|
|
14814
|
+
return $9HbP8$catchify(ev => link && router_.navigate_.go_to_({
|
|
14815
|
+
new_url_: link,
|
|
14816
|
+
is_replace_: false,
|
|
14817
|
+
event_: ev
|
|
14818
|
+
}));
|
|
14819
|
+
}
|
|
14820
|
+
}, link && {
|
|
14821
|
+
href: link
|
|
14822
|
+
}, {
|
|
14823
|
+
get children() {
|
|
14824
|
+
return $9HbP8$createComponent((0, $e8ffe11ed01df0fe$export$6e5611bc7e57e477), {
|
|
14825
|
+
get size() {
|
|
14826
|
+
return $9HbP8$createMemo(() => wrapperSize()?.() || 0);
|
|
14827
|
+
},
|
|
14828
|
+
src: mediaUrl,
|
|
14829
|
+
"class": "d-standard-content"
|
|
14830
|
+
});
|
|
14831
|
+
}
|
|
14832
|
+
}));
|
|
14833
|
+
}
|
|
14834
|
+
if (type === "video") {
|
|
14835
|
+
const pageVisible = $5e3d278ef4c80cd7$export$54299a3c81f5425();
|
|
14836
|
+
return (() => {
|
|
14837
|
+
var _el$ = $9HbP8$getNextElement($f916989c4b1be9f7$var$_tmpl$),
|
|
14838
|
+
_el$2 = _el$.firstChild;
|
|
14839
|
+
$9HbP8$addEventListener(_el$, "click", $9HbP8$catchify(ev => router_.navigate_.go_to_({
|
|
14840
|
+
new_url_: link,
|
|
14841
|
+
is_replace_: false,
|
|
14842
|
+
event_: ev
|
|
14843
|
+
})), true);
|
|
14844
|
+
$9HbP8$setAttribute(_el$, "href", link);
|
|
14845
|
+
$9HbP8$use(element => $9HbP8$createEffect(() => {
|
|
14846
|
+
if (pageVisible()) element.play().catch(e => $9HbP8$dlog1("Failed to play", e));else element.pause();
|
|
14847
|
+
}), _el$2);
|
|
14848
|
+
$9HbP8$setAttribute(_el$2, "src", mediaUrl);
|
|
14849
|
+
$9HbP8$setProperty(_el$2, "controls", false);
|
|
14850
|
+
$9HbP8$setProperty(_el$2, "muted", true);
|
|
14851
|
+
$9HbP8$setProperty(_el$2, "autoplay", true);
|
|
14852
|
+
$9HbP8$setProperty(_el$2, "playsinline", true);
|
|
14853
|
+
$9HbP8$runHydrationEvents();
|
|
14854
|
+
return _el$;
|
|
14855
|
+
})();
|
|
14856
|
+
}
|
|
14857
|
+
}
|
|
14858
|
+
$9HbP8$delegateEvents(["click"]);
|
|
14859
|
+
function $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
|
|
14860
|
+
const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
|
|
14861
|
+
$9HbP8$createEffect(() => {
|
|
14862
|
+
const serverContentBlock = plp_meta()?.content_blocks;
|
|
14863
|
+
if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(historyContentBlocks())) setHistoryContentBlocks(serverContentBlock);
|
|
14864
|
+
});
|
|
14865
|
+
const contentBlocksByRow = $9HbP8$createMemo(() => {
|
|
14866
|
+
if (content_blocks_by_row_()) return content_blocks_by_row_();
|
|
14867
|
+
const content = [];
|
|
14868
|
+
historyContentBlocks().forEach(row => {
|
|
14869
|
+
const contentBlock = {
|
|
14870
|
+
span_columns: row.span_columns,
|
|
14871
|
+
span_rows: row.span_rows,
|
|
14872
|
+
position: row.position,
|
|
14873
|
+
content: () => $9HbP8$createComponent((0, $f916989c4b1be9f7$export$780a853d15174484), {
|
|
14874
|
+
contentBlock_: row,
|
|
14875
|
+
router_: router_
|
|
14876
|
+
})
|
|
14877
|
+
};
|
|
14878
|
+
content[row.row] = contentBlock;
|
|
14879
|
+
});
|
|
14880
|
+
return content;
|
|
14881
|
+
});
|
|
14882
|
+
return contentBlocksByRow;
|
|
14883
|
+
}
|
|
14786
14884
|
var $df5d81d0fe61ff21$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=product-count><!$><!/> <!$><!/>`),
|
|
14787
14885
|
$df5d81d0fe61ff21$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<div>`),
|
|
14788
14886
|
$df5d81d0fe61ff21$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div class=filter-results-for-one-row><!$><!/><!$><!/>`),
|
|
@@ -14810,6 +14908,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
14810
14908
|
show_breadcrumbs_: show_breadcrumbs_,
|
|
14811
14909
|
layout_options_: layout_options_,
|
|
14812
14910
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
14911
|
+
history_content_blocks_: history_content_blocks_,
|
|
14813
14912
|
product_card_template_: product_card_template_,
|
|
14814
14913
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
14815
14914
|
sorting_query_param_: sorting_query_param_,
|
|
@@ -14878,6 +14977,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
14878
14977
|
}));
|
|
14879
14978
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
14880
14979
|
const [plp_meta] = $9HbP8$createResource(meta_query_base, $9HbP8$catchify(query => depict_api_.get_listing(query)));
|
|
14980
|
+
const contentBlocksByRow = $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
|
|
14881
14981
|
const available_sortings_ = $9HbP8$createMemo(() => plp_products_()?.sorts?.map(sort => ({
|
|
14882
14982
|
...sort,
|
|
14883
14983
|
order: sort.order ?? "desc"
|
|
@@ -15138,7 +15238,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
15138
15238
|
product_card_template_: product_card_template_,
|
|
15139
15239
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
15140
15240
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
15141
|
-
content_blocks_by_row_:
|
|
15241
|
+
content_blocks_by_row_: contentBlocksByRow,
|
|
15142
15242
|
ConfiguredScrollStatus_: ConfiguredScrollStatus_,
|
|
15143
15243
|
id_currently_querying_for_: id_to_query_for_,
|
|
15144
15244
|
no_results_options_: {
|
|
@@ -15232,7 +15332,8 @@ function $442f32a4d80abbde$export$e2bf8ce7779e827e(props) {
|
|
|
15232
15332
|
sorting_open: category_sorting_open_,
|
|
15233
15333
|
expanded_filters: expanded_filters_,
|
|
15234
15334
|
expanded_hierarchical_filters: expanded_hierarchical_filters_,
|
|
15235
|
-
scroll_restoration_data: scroll_restoration_data_
|
|
15335
|
+
scroll_restoration_data: scroll_restoration_data_,
|
|
15336
|
+
history_content_blocks: history_content_blocks_
|
|
15236
15337
|
} = depict_category.historyStateSignals_;
|
|
15237
15338
|
const {
|
|
15238
15339
|
current_sorting_: current_sorting_,
|
|
@@ -15278,6 +15379,7 @@ function $442f32a4d80abbde$export$e2bf8ce7779e827e(props) {
|
|
|
15278
15379
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
15279
15380
|
content_blocks_by_row_: () => props.content_blocks_by_row,
|
|
15280
15381
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
15382
|
+
history_content_blocks_: history_content_blocks_,
|
|
15281
15383
|
layout_options_: $9HbP8$createMemo(() => ({
|
|
15282
15384
|
cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77(props.cols_at_size),
|
|
15283
15385
|
...grid_spacing_override(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/ui",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.32",
|
|
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",
|