@depict-ai/ui 4.7.35 → 4.8.1
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 +148 -92
- package/ES10/index.d.ts +61 -61
- package/ES10/index.js +149 -92
- package/latest/index.cjs +142 -86
- package/latest/index.d.ts +61 -61
- package/latest/index.js +143 -86
- package/package.json +2 -2
- package/server/ES10/index.cjs +135 -73
- package/server/ES10/index.d.ts +61 -61
- package/server/ES10/index.js +136 -73
- package/server/latest/index.cjs +129 -67
- package/server/latest/index.d.ts +61 -61
- package/server/latest/index.js +130 -67
package/latest/index.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { add_to_version_info as $9HbP8$add_to_version_info, queueMacroTask as $9HbP8$queueMacroTask, catchify as $9HbP8$catchify, findMostFrequentItem as $9HbP8$findMostFrequentItem, dwarn as $9HbP8$dwarn, observer as $9HbP8$observer, layout_media_query_header as $9HbP8$layout_media_query_header, javascript_media_query as $9HbP8$javascript_media_query, make_random_classname as $9HbP8$make_random_classname, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, report as $9HbP8$report, slider_fading_factory as $9HbP8$slider_fading_factory, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, dlog as $9HbP8$dlog1, camelCasifyObject as $9HbP8$camelCasifyObject, useExpandingContainer as $9HbP8$useExpandingContainer, fetch_retry as $9HbP8$fetch_retry, base_url as $9HbP8$base_url, slider_fractional_factory as $9HbP8$slider_fractional_factory, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, standard_price_format as $9HbP8$standard_price_format, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, use_href_accessor as $9HbP8$use_href_accessor, get_session_id as $9HbP8$get_session_id, add_version_query_params as $9HbP8$add_version_query_params, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, snakeCasifyObject as $9HbP8$snakeCasifyObject, sort_obj as $9HbP8$sort_obj, make_url_with_query_params as $9HbP8$make_url_with_query_params, insert_surfaces as $9HbP8$insert_surfaces, is_debug as $9HbP8$is_debug } from "@depict-ai/utilishared/latest";
|
|
2
2
|
import { createComponent as $9HbP8$createComponent, mergeProps as $9HbP8$mergeProps, insert as $9HbP8$insert, template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, effect as $9HbP8$effect, style as $9HbP8$style, className as $9HbP8$className, spread as $9HbP8$spread, runHydrationEvents as $9HbP8$runHydrationEvents, getNextMarker as $9HbP8$getNextMarker, classList as $9HbP8$classList, isServer as $9HbP8$isServer, setAttribute as $9HbP8$setAttribute, addEventListener as $9HbP8$addEventListener, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, use as $9HbP8$use, setProperty as $9HbP8$setProperty, Dynamic as $9HbP8$Dynamic } from "solid-js/web";
|
|
3
|
-
import { createSignal as $9HbP8$createSignal, getOwner as $9HbP8$getOwner, createEffect as $9HbP8$createEffect, runWithOwner as $9HbP8$runWithOwner, onCleanup as $9HbP8$onCleanup, createContext as $9HbP8$createContext, useContext as $9HbP8$useContext, createMemo as $9HbP8$createMemo, splitProps as $9HbP8$splitProps, mergeProps as $9HbP8$mergeProps1, untrack as $9HbP8$untrack, createRenderEffect as $9HbP8$createRenderEffect, Show as $9HbP8$Show, batch as $9HbP8$batch, createComputed as $9HbP8$createComputed, mapArray as $9HbP8$mapArray, createResource as $9HbP8$createResource, Suspense as $9HbP8$Suspense, createUniqueId as $9HbP8$createUniqueId, ErrorBoundary as $9HbP8$ErrorBoundary, createRoot as $9HbP8$createRoot, For as $9HbP8$For, Index as $9HbP8$Index, on as $9HbP8$on, createSelector as $9HbP8$createSelector, children as $9HbP8$children, createReaction as $9HbP8$createReaction } from "solid-js";
|
|
3
|
+
import { createSignal as $9HbP8$createSignal, getOwner as $9HbP8$getOwner, createEffect as $9HbP8$createEffect, runWithOwner as $9HbP8$runWithOwner, onCleanup as $9HbP8$onCleanup, createContext as $9HbP8$createContext, useContext as $9HbP8$useContext, createMemo as $9HbP8$createMemo, splitProps as $9HbP8$splitProps, mergeProps as $9HbP8$mergeProps1, untrack as $9HbP8$untrack, createRenderEffect as $9HbP8$createRenderEffect, Show as $9HbP8$Show, batch as $9HbP8$batch, createComputed as $9HbP8$createComputed, mapArray as $9HbP8$mapArray, createResource as $9HbP8$createResource, Suspense as $9HbP8$Suspense, createUniqueId as $9HbP8$createUniqueId, ErrorBoundary as $9HbP8$ErrorBoundary, createRoot as $9HbP8$createRoot, For as $9HbP8$For, Index as $9HbP8$Index, on as $9HbP8$on, createSelector as $9HbP8$createSelector, children as $9HbP8$children, createReaction as $9HbP8$createReaction, Switch as $9HbP8$Switch, Match as $9HbP8$Match } from "solid-js";
|
|
4
4
|
import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from "solid-js/store";
|
|
5
5
|
import { dlog as $9HbP8$dlog, catchify as $9HbP8$catchify1, ListenableSet as $9HbP8$ListenableSet, use_href_accessor as $9HbP8$use_href_accessor1, queueMacroTask as $9HbP8$queueMacroTask1, report as $9HbP8$report1 } from "@depict-ai/utilishared/latest";
|
|
6
6
|
|
|
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.
|
|
10
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "4.8.1";
|
|
11
|
+
|
|
12
|
+
// Value first so shopify merchants can set (extra) display transformers in the shopify app
|
|
13
|
+
// Calling these functions normally doesn't do anything, but our shopify app respects them
|
|
14
|
+
// Them being here is value first too because this can be easily imported in the product card editor
|
|
15
|
+
let $a63fa9cb46ed211b$var$extraDisplayTransformers;
|
|
16
|
+
const $a63fa9cb46ed211b$export$b2d94be4f02525b2 = () => $a63fa9cb46ed211b$var$extraDisplayTransformers;
|
|
17
|
+
const $a63fa9cb46ed211b$export$f98b8d5ea7207a1 = displayTransformers => $a63fa9cb46ed211b$var$extraDisplayTransformers = displayTransformers;
|
|
11
18
|
const $011607bdf658f807$var$ListingContext = /*@__PURE__*/$9HbP8$createContext();
|
|
12
19
|
function $011607bdf658f807$export$e68cff63f76bd15b(props) {
|
|
13
20
|
const our_object = {};
|
|
@@ -87,7 +94,11 @@ const $e8ffe11ed01df0fe$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingCo
|
|
|
87
94
|
function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
|
|
88
95
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
89
96
|
const [ourRatioKeyed, setOurRatioKeyed] = $9HbP8$createSignal();
|
|
97
|
+
const [rAFSinceReturned, setRAFSinceReturned] = $9HbP8$createSignal(false);
|
|
90
98
|
const sizeToUse = $9HbP8$createMemo(() => {
|
|
99
|
+
// We first put the images into the DOM after they have been decoded. We can only get the correct object-fit value after the image is in the DOM.
|
|
100
|
+
// To avoid using an observer for knowing when the image is in the DOM (one of the most CPU intensive things when we did lighthouse optimisation) we just re-check an animationframe after we told <Show> to show the image, which seems to work reliably
|
|
101
|
+
rAFSinceReturned();
|
|
91
102
|
// props.size could be a getter that expects a cleanup so get it in this memo instead of where we set img.sizes (also we need to multiply, and it's good with some diffing here so people calling the comp don't have to)
|
|
92
103
|
const incomingSize = props.size();
|
|
93
104
|
const ratio = ourRatioKeyed();
|
|
@@ -243,6 +254,7 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
|
|
|
243
254
|
hasDecodedFastPath = true;
|
|
244
255
|
});
|
|
245
256
|
});
|
|
257
|
+
$9HbP8$createEffect(() => hasDecoded() && requestAnimationFrame($9HbP8$catchify(() => setRAFSinceReturned(prev => !prev))));
|
|
246
258
|
return $9HbP8$createComponent((0, $9HbP8$Show), {
|
|
247
259
|
get when() {
|
|
248
260
|
return hasDecoded();
|
|
@@ -459,13 +471,6 @@ function $70bb27cc6be01fc7$export$140423fa4bfb6d63(props) {
|
|
|
459
471
|
customUrls: $70bb27cc6be01fc7$var$customUrls
|
|
460
472
|
}));
|
|
461
473
|
}
|
|
462
|
-
|
|
463
|
-
// Value first so shopify merchants can set (extra) display transformers in the shopify app
|
|
464
|
-
// Calling these functions normally doesn't do anything, but our shopify app respects them
|
|
465
|
-
// Them being here is value first too because this can be easily imported in the product card editor
|
|
466
|
-
let $a63fa9cb46ed211b$var$extraDisplayTransformers;
|
|
467
|
-
const $a63fa9cb46ed211b$export$b2d94be4f02525b2 = () => $a63fa9cb46ed211b$var$extraDisplayTransformers;
|
|
468
|
-
const $a63fa9cb46ed211b$export$f98b8d5ea7207a1 = displayTransformers => $a63fa9cb46ed211b$var$extraDisplayTransformers = displayTransformers;
|
|
469
474
|
function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
|
|
470
475
|
const signal = $9HbP8$createSignal(false);
|
|
471
476
|
$9HbP8$onCleanup($9HbP8$javascript_media_query(media_query, ({
|
|
@@ -9806,16 +9811,19 @@ async function $4b2134398dfa83fa$var$download_categories(merchant, market, local
|
|
|
9806
9811
|
function $a8fa7302d6f93c0b$export$9862539c89138352({
|
|
9807
9812
|
get_default_values_: get_default_values_,
|
|
9808
9813
|
router_: router_,
|
|
9809
|
-
prefix_: prefix_
|
|
9814
|
+
prefix_: prefix_,
|
|
9815
|
+
preserveKeys_: preserveKeys_
|
|
9810
9816
|
}) {
|
|
9811
9817
|
const get_prefixed_default_values_ = () => {
|
|
9812
9818
|
const default_values = get_default_values_();
|
|
9813
9819
|
return Object.fromEntries(Object.entries(default_values).map(([key, value]) => [prefix_ + key, value]));
|
|
9814
9820
|
};
|
|
9815
9821
|
const prefixed_state = $ca6f574bd8772184$export$e183a13865960371(get_prefixed_default_values_(), router_);
|
|
9822
|
+
const prefixedPreserveKeys = preserveKeys_?.map(key => prefix_ + key);
|
|
9816
9823
|
const reset_state = () => {
|
|
9817
9824
|
const new_defaults = get_prefixed_default_values_();
|
|
9818
9825
|
for (const key in prefixed_state) {
|
|
9826
|
+
if (prefixedPreserveKeys?.includes(key)) continue;
|
|
9819
9827
|
const new_value = new_defaults[key];
|
|
9820
9828
|
prefixed_state[key][1](new_value);
|
|
9821
9829
|
}
|
|
@@ -10424,8 +10432,13 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
|
|
|
10424
10432
|
local_filter_cache: [],
|
|
10425
10433
|
expanded_hierarchical_filters: [],
|
|
10426
10434
|
scroll_restoration_data: [],
|
|
10427
|
-
history_content_blocks:
|
|
10435
|
+
history_content_blocks: {
|
|
10436
|
+
blocks: [],
|
|
10437
|
+
aspectRatios: {}
|
|
10438
|
+
}
|
|
10428
10439
|
}),
|
|
10440
|
+
// Don't reset content block stuff when leaving category page as we need it for scroll restoration, same with scroll restoration data (actually a bit unsure if this is needed, I think it depends on if someone cleans up our elements before the location changes or after, and maybe some of the test flakyness we have seen is due to this not existing before?)
|
|
10441
|
+
preserveKeys_: ["history_content_blocks", "scroll_restoration_data"],
|
|
10429
10442
|
router_: this.#router,
|
|
10430
10443
|
prefix_: "category" + unique_instance_key_for_state + "_"
|
|
10431
10444
|
});
|
|
@@ -11343,8 +11356,15 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
11343
11356
|
for_id: for_id
|
|
11344
11357
|
}) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
|
|
11345
11358
|
});
|
|
11346
|
-
const
|
|
11347
|
-
|
|
11359
|
+
const layout = $9HbP8$createMemo(() => {
|
|
11360
|
+
const incoming_layout = layout_options_().layout;
|
|
11361
|
+
if (incoming_layout === "slider-without-filters") return "slider";
|
|
11362
|
+
return incoming_layout || "grid";
|
|
11363
|
+
});
|
|
11364
|
+
const doesnt_have_content_blocks = $9HbP8$createMemo(() => !content_blocks_by_row_() || layout() !== "grid");
|
|
11365
|
+
const content_blocks_ = $9HbP8$createMemo(() => doesnt_have_content_blocks() ?
|
|
11366
|
+
// This bailing here is to not use proxy/stores and retain old browser compatibility when no content blocks are present
|
|
11367
|
+
() => [] : $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
|
|
11348
11368
|
content_blocks_: content_blocks_by_row_,
|
|
11349
11369
|
cols_at_size_: modified_cols_at_size,
|
|
11350
11370
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
@@ -11356,11 +11376,6 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
11356
11376
|
num_placeholders_: num_placeholders_
|
|
11357
11377
|
});
|
|
11358
11378
|
});
|
|
11359
|
-
const layout = $9HbP8$createMemo(() => {
|
|
11360
|
-
const incoming_layout = layout_options_().layout;
|
|
11361
|
-
if (incoming_layout === "slider-without-filters") return "slider";
|
|
11362
|
-
return incoming_layout || "grid";
|
|
11363
|
-
});
|
|
11364
11379
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $9HbP8$createSignal(false);
|
|
11365
11380
|
const block_suspense_if_needed = () => {
|
|
11366
11381
|
if (!is_just_after_plp_results_update) return;
|
|
@@ -11383,7 +11398,6 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
11383
11398
|
}, {
|
|
11384
11399
|
defer: true
|
|
11385
11400
|
}));
|
|
11386
|
-
$9HbP8$createEffect(() => layout() !== "grid" && !doesnt_have_content_blocks() && $9HbP8$dwarn("Slider layout doesn't support content blocks"));
|
|
11387
11401
|
/*
|
|
11388
11402
|
This suspense ensures that if someone has async templates, we still show placeholders until the product cards actually have finished rendering (automagically since they're createResource's)
|
|
11389
11403
|
We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
|
|
@@ -14817,89 +14831,132 @@ function $cc6f5b69378cd164$export$7af06a63c5a976c9(el, listing_id, i18n_) {
|
|
|
14817
14831
|
$9HbP8$onCleanup(disconnect);
|
|
14818
14832
|
}
|
|
14819
14833
|
$9HbP8$delegateEvents(["click"]);
|
|
14820
|
-
var $f916989c4b1be9f7$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<
|
|
14834
|
+
var $f916989c4b1be9f7$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<video loop class=d-standard-content>`);
|
|
14821
14835
|
function $f916989c4b1be9f7$export$780a853d15174484({
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
},
|
|
14829
|
-
router_: router_
|
|
14836
|
+
link_: link_,
|
|
14837
|
+
type_: type_,
|
|
14838
|
+
router_: router_,
|
|
14839
|
+
setAspectRatioWas_: setAspectRatioWas_,
|
|
14840
|
+
mediaUrl_: mediaUrl_,
|
|
14841
|
+
aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
|
|
14830
14842
|
}) {
|
|
14831
|
-
|
|
14832
|
-
|
|
14833
|
-
|
|
14834
|
-
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
}
|
|
14844
|
-
}, link && {
|
|
14845
|
-
href: link
|
|
14846
|
-
}, {
|
|
14847
|
-
get children() {
|
|
14848
|
-
return $9HbP8$createComponent((0, $70bb27cc6be01fc7$export$140423fa4bfb6d63), {
|
|
14849
|
-
size: () => wrapperSize()?.[0]?.() || 0,
|
|
14850
|
-
sizeHeight: () => wrapperSize()?.[1]?.() || 0,
|
|
14851
|
-
src: mediaUrl,
|
|
14852
|
-
"class": "d-standard-content"
|
|
14853
|
-
});
|
|
14854
|
-
}
|
|
14855
|
-
}));
|
|
14856
|
-
}
|
|
14857
|
-
if (type === "video") {
|
|
14858
|
-
const pageVisible = $5e3d278ef4c80cd7$export$54299a3c81f5425();
|
|
14859
|
-
return (() => {
|
|
14860
|
-
var _el$ = $9HbP8$getNextElement($f916989c4b1be9f7$var$_tmpl$),
|
|
14861
|
-
_el$2 = _el$.firstChild;
|
|
14862
|
-
$9HbP8$addEventListener(_el$, "click", $9HbP8$catchify1(ev => router_.navigate_.go_to_({
|
|
14863
|
-
new_url_: link,
|
|
14843
|
+
const [wrapperSize, setWrapperSize] = $9HbP8$createSignal();
|
|
14844
|
+
const isImage = type_ === "image";
|
|
14845
|
+
return $9HbP8$createComponent((0, $9HbP8$Dynamic), $9HbP8$mergeProps({
|
|
14846
|
+
component: link_ ? "a" : "div",
|
|
14847
|
+
"class": "d-standard-content-wrapper",
|
|
14848
|
+
get style() {
|
|
14849
|
+
return $9HbP8$memo(() => !!aspectRatioWhenAloneInRow_())() ? `--media-aspect-ratio: ${aspectRatioWhenAloneInRow_()}` : "";
|
|
14850
|
+
},
|
|
14851
|
+
ref: el => isImage && setWrapperSize(() => $a444a52bafa0dacc$export$54c6d6ff54e72743(el)),
|
|
14852
|
+
get onClick() {
|
|
14853
|
+
return $9HbP8$catchify1(ev => link_ && router_.navigate_.go_to_({
|
|
14854
|
+
new_url_: link_,
|
|
14864
14855
|
is_replace_: false,
|
|
14865
14856
|
event_: ev
|
|
14866
|
-
}))
|
|
14867
|
-
|
|
14868
|
-
|
|
14869
|
-
|
|
14870
|
-
|
|
14871
|
-
|
|
14872
|
-
$9HbP8$
|
|
14873
|
-
|
|
14874
|
-
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
|
|
14857
|
+
}));
|
|
14858
|
+
}
|
|
14859
|
+
}, link_ && {
|
|
14860
|
+
href: link_
|
|
14861
|
+
}, {
|
|
14862
|
+
get children() {
|
|
14863
|
+
return $9HbP8$createComponent((0, $9HbP8$Switch), {
|
|
14864
|
+
get children() {
|
|
14865
|
+
return [$9HbP8$createComponent((0, $9HbP8$Match), {
|
|
14866
|
+
when: isImage,
|
|
14867
|
+
get children() {
|
|
14868
|
+
return $9HbP8$createComponent((0, $70bb27cc6be01fc7$export$140423fa4bfb6d63), {
|
|
14869
|
+
size: () => wrapperSize()?.[0]?.() || 0,
|
|
14870
|
+
sizeHeight: () => wrapperSize()?.[1]?.() || 0,
|
|
14871
|
+
src: mediaUrl_,
|
|
14872
|
+
"class": "d-standard-content",
|
|
14873
|
+
ref: el => el.addEventListener("load", $9HbP8$catchify1(() => setAspectRatioWas_(el.naturalWidth / el.naturalHeight)))
|
|
14874
|
+
});
|
|
14875
|
+
}
|
|
14876
|
+
}), $9HbP8$createComponent((0, $9HbP8$Match), {
|
|
14877
|
+
when: type_ === "video",
|
|
14878
|
+
get children() {
|
|
14879
|
+
var _el$ = $9HbP8$getNextElement($f916989c4b1be9f7$var$_tmpl$);
|
|
14880
|
+
$9HbP8$use(element => {
|
|
14881
|
+
const pageVisible = $5e3d278ef4c80cd7$export$54299a3c81f5425();
|
|
14882
|
+
element.addEventListener("loadedmetadata", $9HbP8$catchify1(() => setAspectRatioWas_(element.videoWidth / element.videoHeight)));
|
|
14883
|
+
$9HbP8$createEffect(() => {
|
|
14884
|
+
if (pageVisible()) element.play().catch(e => $9HbP8$dlog1("Failed to play", e));else element.pause();
|
|
14885
|
+
});
|
|
14886
|
+
}, _el$);
|
|
14887
|
+
$9HbP8$setAttribute(_el$, "src", mediaUrl_);
|
|
14888
|
+
$9HbP8$setProperty(_el$, "controls", false);
|
|
14889
|
+
$9HbP8$setProperty(_el$, "muted", true);
|
|
14890
|
+
$9HbP8$setProperty(_el$, "autoplay", true);
|
|
14891
|
+
$9HbP8$setProperty(_el$, "playsinline", true);
|
|
14892
|
+
return _el$;
|
|
14893
|
+
}
|
|
14894
|
+
})];
|
|
14895
|
+
}
|
|
14896
|
+
});
|
|
14897
|
+
}
|
|
14898
|
+
}));
|
|
14880
14899
|
}
|
|
14881
|
-
$9HbP8$delegateEvents(["click"]);
|
|
14882
14900
|
function $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
|
|
14901
|
+
let hasSeenContentBlock = false;
|
|
14883
14902
|
const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
|
|
14903
|
+
const contentComponents = new Map();
|
|
14884
14904
|
$9HbP8$createEffect(() => {
|
|
14885
14905
|
const serverContentBlock = plp_meta()?.content_blocks;
|
|
14886
|
-
|
|
14906
|
+
const currentHistory = $9HbP8$untrack(historyContentBlocks);
|
|
14907
|
+
// Only write to the history if the content blocks have changed when a new backend results arrives (we have them in history so scroll restoration works when going back, even when running shopify without single page navigations where our script dies inbetween pages).
|
|
14908
|
+
if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(currentHistory.blocks)) setHistoryContentBlocks({
|
|
14909
|
+
...currentHistory,
|
|
14910
|
+
blocks: serverContentBlock
|
|
14911
|
+
});
|
|
14887
14912
|
});
|
|
14888
14913
|
const contentBlocksByRow = $9HbP8$createMemo(() => {
|
|
14889
14914
|
const developerProvided = content_blocks_by_row_();
|
|
14890
|
-
const
|
|
14891
|
-
|
|
14892
|
-
|
|
14915
|
+
const {
|
|
14916
|
+
blocks: blocksFromHistory
|
|
14917
|
+
} = historyContentBlocks();
|
|
14918
|
+
if (developerProvided) return developerProvided;
|
|
14919
|
+
// If we didn't get any content blocks (backend always return empty array) and we haven't seen any content blocks yet, return undefined
|
|
14920
|
+
// This is so the result rendering (PLPResults) will still use flexbox provided rendering on existing customers, so adding this isn't a breaking change
|
|
14921
|
+
// We don't want to switch rendering method every time one switches between a collection that hasn't vs has content blocks though, so once we've seen one content block we'll switch to css-grid-based rendering
|
|
14922
|
+
if (!blocksFromHistory?.length && !hasSeenContentBlock) return;
|
|
14893
14923
|
const content = [];
|
|
14894
|
-
|
|
14924
|
+
hasSeenContentBlock = true;
|
|
14925
|
+
blocksFromHistory.forEach(row => {
|
|
14926
|
+
const {
|
|
14927
|
+
content: {
|
|
14928
|
+
link: link,
|
|
14929
|
+
type: type,
|
|
14930
|
+
url: url
|
|
14931
|
+
}
|
|
14932
|
+
} = row;
|
|
14933
|
+
// Key the "content"-component by the link, type and url, so we can reuse the component (and later downstream the block elements) if it's the same
|
|
14934
|
+
// This makes the block not flicker when going backwards/forwards if the content is the same on both pages
|
|
14935
|
+
// Also it lets us rewrite the blocks state in the history based on the block aspect ratio without infinite looping
|
|
14936
|
+
const componentCacheKey = JSON.stringify([link, type, url]);
|
|
14937
|
+
let component = contentComponents.get(componentCacheKey);
|
|
14938
|
+
if (!component) {
|
|
14939
|
+
component = () => $9HbP8$createComponent((0, $f916989c4b1be9f7$export$780a853d15174484), {
|
|
14940
|
+
link_: link,
|
|
14941
|
+
type_: type,
|
|
14942
|
+
mediaUrl_: url,
|
|
14943
|
+
router_: router_,
|
|
14944
|
+
aspectRatioWhenAloneInRow_: () => historyContentBlocks().aspectRatios[componentCacheKey],
|
|
14945
|
+
setAspectRatioWas_: aspectRatio => setHistoryContentBlocks(prev => ({
|
|
14946
|
+
...prev,
|
|
14947
|
+
aspectRatios: {
|
|
14948
|
+
...prev.aspectRatios,
|
|
14949
|
+
[componentCacheKey]: Math.round(aspectRatio * 100) / 100
|
|
14950
|
+
}
|
|
14951
|
+
}))
|
|
14952
|
+
});
|
|
14953
|
+
contentComponents.set(componentCacheKey, component);
|
|
14954
|
+
}
|
|
14895
14955
|
const contentBlock = {
|
|
14896
14956
|
span_columns: row.span_columns,
|
|
14897
14957
|
span_rows: row.span_rows,
|
|
14898
14958
|
position: row.position,
|
|
14899
|
-
content:
|
|
14900
|
-
contentBlock_: row,
|
|
14901
|
-
router_: router_
|
|
14902
|
-
})
|
|
14959
|
+
content: component
|
|
14903
14960
|
};
|
|
14904
14961
|
content[row.row] = contentBlock;
|
|
14905
14962
|
});
|
|
@@ -15418,4 +15475,4 @@ function $442f32a4d80abbde$export$e2bf8ce7779e827e(props) {
|
|
|
15418
15475
|
}, "Entire CategoryPage failed");
|
|
15419
15476
|
}
|
|
15420
15477
|
$9HbP8$add_to_version_info("ui", (0, $ec291e0010116877$export$83d89fbfd8236492));
|
|
15421
|
-
export { $
|
|
15478
|
+
export { $a63fa9cb46ed211b$export$f98b8d5ea7207a1 as setExtraDisplayTransformers, $a63fa9cb46ed211b$export$b2d94be4f02525b2 as getExtraDisplayTransformers, $70bb27cc6be01fc7$export$140423fa4bfb6d63 as ModernResponsiveImage, $e7a7eb102ddc0c79$export$92aa5d691d588f3f as remap_blocks_to_index, $4eb0a704f8f30273$export$d4d96868197be50e as useMobileHover, $5e3d278ef4c80cd7$export$54299a3c81f5425 as useVisibilityState, $f32e14878e75af51$export$eaa625fb39439e37 as useSlidableInformation, $f091294da861020c$export$80bb7300ce6a8be3 as useProductCardIsVisible, $f091294da861020c$export$f223d69ed12f5fb7 as CurrentlyIntersectingContext, $24e27fab9c821b86$export$5bad61ecde080b1f as useExpandingContainerReactive, $07ef910e8ef6b783$export$2c9f9bf2092486aa as LooksSliderOrGrid, $e9d1d09be9e6471e$export$44809a8a3e867e30 as LookCard, $4fd2ba03703a7d92$export$7e1297a3a19f10d8 as PseudoRouter, $de6ccd37192b5fc2$export$83bb9af5671e1dbe as promiseSafeStructuredClone, $90980bd87c9960f9$export$5162a71f252e6122 as preserve_items_in_history_dot_state, $90980bd87c9960f9$export$3064e1e8c6513da3 as prefixes_to_preserve_in_history_dot_state, $a281666e5c15c2ec$export$29d28dadc2d6b631 as allowNativeNavigation, $66db7a014e20802e$export$1ea76ea778b880dd as modalVersionSymbol, $136f1d4d6c7ba6ac$export$e417c49320921907 as createDeparallelizedNoDropResource, $d8dbf52fea1773e2$export$f50b88e2a00918b5 as throw_globally, $42912431795f188e$export$9265e66f26f8e383 as ClassicSearchModal, $500a16dd18ee5a71$export$b0c55aa2e87c4be7 as SearchModalV2, $70bb27cc6be01fc7$export$9d4a4b669b1929ab as ModernResponsiveContainedImage, $024fbc0a2d796fad$export$3e41faf802a29e71 as Tab, $024fbc0a2d796fad$export$b2539bed5023c21c as Tabs, $8560c919ff763930$export$d4973c31938cbfd1 as ShopTheLookButton, $ca6f574bd8772184$export$e183a13865960371 as history_dot_state_to_state, $4147651646da990a$export$916e6850778505f6 as strip_encoded_filter_and_sort, $4147651646da990a$export$58aa3f171519b6d7 as encode_filters, $4147651646da990a$export$f934fa24c3a86811 as decode_filters, $4147651646da990a$export$62acb285a7579555 as encode_sorting, $4147651646da990a$export$766e9676e74997d3 as decode_sorting, $660070e2a394b3c3$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $011607bdf658f807$export$e68cff63f76bd15b as ListingProvider, $011607bdf658f807$export$8d0c4fdbb05a2f2e as useListing, $b6440e72ed83671a$export$11354f017ddc9790 as ProductCardIndexProvider, $b6440e72ed83671a$export$e3faf4d95300054f as useProductCardIndex, $660070e2a394b3c3$export$e4b984597b71e989 as ShopifyContainedImage, $f32e14878e75af51$export$6649caad96ef8870 as SlidableItems, $2449872a62a75a20$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $ee116da074deb002$export$9574e176201e5e8d as RecommendationSlider, $9ea5383493360761$export$9756467d34d91cdb as RecommendationGrid, $e8ffe11ed01df0fe$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $f18d425032111270$export$94026ee33dbabc26 as ImageContainer, $b7436a6d1fd64e3b$export$b69d0d92862de18b as SentryErrorBoundary, $b7436a6d1fd64e3b$export$240ecf5363d76c0f as ExtraSentryContextProvider, $6bb0a0c563dff4bb$export$6c6d7a51fa9aa15d as ExpandingDetails, $c16e74cfe125bb05$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $1adfe60f3a14a1d7$export$fecbb157621501bd as SelectedFilters, $fab07f52c9861732$export$3f1a388cc0d8fed7 as FilterBody, $5efb5894079b220e$export$b288c38ae3fddb56 as create_modified_filters, $c8d5ff4524619fcd$export$d21e32dfedac04be as SolidLayout, $c8d5ff4524619fcd$export$445d8d3f5f706a40 as SolidLayoutWithProvidedElement, $194bd6b8e4c59830$export$79b1565500412d9b as general_modal_abstraction, $19976a74d273070d$export$3b621d86b1566b2 as CrossIcon, $fbbadcb080ad1d4a$export$8be2714ec7f169ee as GenericSliderArrowButton, $a0f0e923bad68a9b$export$58e808b1db15d3bc as fetchDepictRecommendations, $e4615ecd1849548f$export$b91cec6bdc6b32a1 as CategoryTitle, $a6e23a834336fc19$export$824dde41348efed1 as embedded_num_products, $4b2134398dfa83fa$export$c1a6b039e689a58e as get_listings, $961b5c64bef4662f$export$f34314aa9505732e as DepictCategory, $806c97b931758897$export$ac6237957a15b3f0 as DepictSearch, $806c97b931758897$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $806c97b931758897$export$f2dc7e4e4aa11abb as SearchPage, $4fd48cb976bf1789$export$aa14a9f43128f61f as ProductCardError, $6891c018a834cfdd$export$d86a33413558014e as open_modal_with_alignment, $bb15dfb548a7666e$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $b6d5529b253681aa$export$b3ad617e9036868 as align_field, $b6d5529b253681aa$export$3f238c96c45e6cc6 as ALIGN_TOP, $b6d5529b253681aa$export$902f8b4a7dae5d78 as ALIGN_WIDTH_ON_MODAL, $b6d5529b253681aa$export$7895aadd1956b1c7 as ALIGN_LEFT, $b6d5529b253681aa$export$6060bc6bee850eb6 as SET_CENTERED_LEFT, $b5cccc8ee7d24677$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $926b1b5ba2239356$export$1233ca167bf71f9a as styles_to_valid_css_string, $aea1edf92433e81e$export$fe334901e8bebd57 as disable_scrolling, $6e8944558258054f$export$d0596b5cae35ad4 as open_search_with_shift_slash, $7fa23e2a0079eca4$export$e015ed2f2950f2e3 as DepictAPI, $dc9262ef6f786812$export$d9f36cf74e24d595 as media_query_to_accessor, $6936724b9e0b98d5$export$689e204eadb33baf as setup_fast_leave, $bf52d9f9eebd1938$export$5196e4c01fa56fcb as show_toast, $8c0f86cb3e266eeb$export$a71e92cfbb498adc as SolidFormatPrice, $4ca91518c9a35379$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $d20eff0aadc28983$export$acb3eaade4b23afd as BasePlaceholder, $d134eae24341b4a1$export$89c6019e4baa40b1 as TextPlaceholder, $7f60f09116a3fe61$export$3f37af283f8fb843 as ImagePlaceholder, $753e9b2889a47c89$export$3ccaa27d81dd8556 as PageReplacer, $4690a06c8489dcd0$export$864d304a0bc46829 as defaultGridSpacing, $4690a06c8489dcd0$export$c3834fa86c616831 as defaultColsAtSize, $4690a06c8489dcd0$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $ec291e0010116877$export$83d89fbfd8236492 as version, $58b3487626e85ece$export$316f6f283ae64765 as SearchField, $feffae76d8dc0135$export$5b7c3ce0ebe51f86 as BreadCrumbs, $feffae76d8dc0135$export$de035477d6fef996 as QuickLinks, $442f32a4d80abbde$export$e2bf8ce7779e827e as CategoryPage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.1",
|
|
4
4
|
"description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
|
|
5
5
|
"packageManager": "yarn@3.2.2",
|
|
6
6
|
"sass": "styles.scss",
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
"@babel/plugin-transform-typescript": "^7.22.9",
|
|
237
237
|
"@babel/runtime": "latest",
|
|
238
238
|
"@babel/runtime-corejs3": "^7.22.6",
|
|
239
|
-
"@depict-ai/plp-styling": "^4.4.
|
|
239
|
+
"@depict-ai/plp-styling": "^4.4.10",
|
|
240
240
|
"@depict-ai/types": "^5.4.2",
|
|
241
241
|
"@depict-ai/utilishared": "^2.4.4",
|
|
242
242
|
"solid-js": "^1.8.12"
|