@depict-ai/ui 4.7.29 → 4.7.31
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 +630 -547
- package/ES10/index.d.ts +105 -81
- package/ES10/index.js +665 -583
- package/latest/index.cjs +580 -499
- package/latest/index.d.ts +105 -81
- package/latest/index.js +616 -536
- package/package.json +1 -1
- package/server/ES10/index.cjs +288 -261
- package/server/ES10/index.d.ts +105 -81
- package/server/ES10/index.js +329 -303
- package/server/latest/index.cjs +263 -238
- package/server/latest/index.d.ts +105 -81
- package/server/latest/index.js +305 -281
package/server/latest/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var $5vyXB$depictaiutilishared = require("@depict-ai/utilishared/latest");
|
|
2
|
-
var $5vyXB$depictaiutilisharedlatest = require("@depict-ai/utilishared/latest");
|
|
3
|
-
var $5vyXB$solidjs = require("solid-js");
|
|
4
2
|
var $5vyXB$solidjsweb = require("solid-js/web");
|
|
3
|
+
var $5vyXB$solidjs = require("solid-js");
|
|
5
4
|
var $5vyXB$solidjsstore = require("solid-js/store");
|
|
5
|
+
var $5vyXB$depictaiutilisharedlatest = require("@depict-ai/utilishared/latest");
|
|
6
6
|
require("../../multi_import_deduplicator.cjs").register_es_version("ui", "latest");
|
|
7
7
|
function $parcel$export(e, n, v, s) {
|
|
8
8
|
Object.defineProperty(e, n, {
|
|
@@ -12,6 +12,7 @@ function $parcel$export(e, n, v, s) {
|
|
|
12
12
|
configurable: true
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
+
$parcel$export(module.exports, "remap_blocks_to_index", () => $d92f338ba8f9da9b$export$92aa5d691d588f3f);
|
|
15
16
|
$parcel$export(module.exports, "useMobileHover", () => $8bf678c45948a297$export$d4d96868197be50e);
|
|
16
17
|
$parcel$export(module.exports, "useVisibilityState", () => $55cbacb79d3e0cea$export$54299a3c81f5425);
|
|
17
18
|
$parcel$export(module.exports, "useSlidableInformation", () => $a0e53f99354809d9$export$eaa625fb39439e37);
|
|
@@ -104,7 +105,237 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
|
|
|
104
105
|
$parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
|
|
105
106
|
$parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
|
|
106
107
|
/*! Depict.ai search and product listing SDK */
|
|
107
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.7.
|
|
108
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.7.31";
|
|
109
|
+
function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
|
|
110
|
+
const signal = $5vyXB$solidjs.createSignal(false);
|
|
111
|
+
$5vyXB$solidjs.onCleanup($5vyXB$depictaiutilishared.javascript_media_query(media_query, ({
|
|
112
|
+
matches: matches
|
|
113
|
+
}) => signal[1](matches)).remove);
|
|
114
|
+
return signal[0];
|
|
115
|
+
}
|
|
116
|
+
function $17d06b3bcb035500$export$a79e666719b3647c(cols_at_size_) {
|
|
117
|
+
const size_active = $5vyXB$solidjs.createMemo(() => cols_at_size_().map(([n_cols, min_width, max_width]) => {
|
|
118
|
+
const media_query = $5vyXB$depictaiutilishared.layout_media_query_header(min_width, max_width).replaceAll("@media", "");
|
|
119
|
+
const matches = $b54e6192d0caa293$export$d9f36cf74e24d595(media_query);
|
|
120
|
+
return [matches, n_cols];
|
|
121
|
+
}));
|
|
122
|
+
const n_cols_currently_showing = $5vyXB$solidjs.createMemo(() => {
|
|
123
|
+
try {
|
|
124
|
+
const [, n_cols_currently_showing] = size_active().find(([media_query]) => media_query());
|
|
125
|
+
return n_cols_currently_showing;
|
|
126
|
+
} catch (e) {
|
|
127
|
+
$5vyXB$depictaiutilishared.dwarn("No active size found in columnsAtSize - can't render content blocks or looks");
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
return n_cols_currently_showing;
|
|
132
|
+
}
|
|
133
|
+
var $9fe9883b1d8ecccc$var$_tmpl$ = ["<span", ' class="', '" style="', '"></span>'];
|
|
134
|
+
function $9fe9883b1d8ecccc$export$acb3eaade4b23afd(props) {
|
|
135
|
+
// Work around https://github.com/solidjs/solid/issues/1980
|
|
136
|
+
return $5vyXB$solidjsweb.ssr($9fe9883b1d8ecccc$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), `${$5vyXB$solidjsweb.escape(props.class, true) || ""} depict-placeholder`, $5vyXB$solidjsweb.ssrStyle(props.style));
|
|
137
|
+
}
|
|
138
|
+
function $3bc4a89b971a3af5$export$3f37af283f8fb843(props) {
|
|
139
|
+
const style = $5vyXB$solidjs.createMemo(() => {
|
|
140
|
+
const {
|
|
141
|
+
style: style,
|
|
142
|
+
height: height,
|
|
143
|
+
width: width,
|
|
144
|
+
aspectRatio: aspectRatio
|
|
145
|
+
} = props;
|
|
146
|
+
const is_image = aspectRatio != undefined;
|
|
147
|
+
const size_data = is_image ? {
|
|
148
|
+
width: "100%",
|
|
149
|
+
"padding-bottom": `calc(calc(1 / ${aspectRatio}) * 100%)`
|
|
150
|
+
} : {
|
|
151
|
+
width: width,
|
|
152
|
+
height: height
|
|
153
|
+
};
|
|
154
|
+
return {
|
|
155
|
+
display: "block",
|
|
156
|
+
...(style || {}),
|
|
157
|
+
...size_data
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
return $5vyXB$solidjsweb.createComponent((0, $9fe9883b1d8ecccc$export$acb3eaade4b23afd), {
|
|
161
|
+
get style() {
|
|
162
|
+
return style();
|
|
163
|
+
},
|
|
164
|
+
get ["class"]() {
|
|
165
|
+
return props.class;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
var $d92f338ba8f9da9b$var$_tmpl$ = ["<div", ' class="content-block-wrapper" style="', '">', "</div>"];
|
|
170
|
+
function $d92f338ba8f9da9b$export$791ef57e62e21c3f({
|
|
171
|
+
content_blocks_: incoming_content_blocks,
|
|
172
|
+
cols_at_size_: cols_at_size_,
|
|
173
|
+
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
174
|
+
}) {
|
|
175
|
+
// these are by row
|
|
176
|
+
const [content_blocks, set_content_blocks] = $5vyXB$solidjsstore.createStore([]);
|
|
177
|
+
const n_cols_currently_showing_ = $17d06b3bcb035500$export$a79e666719b3647c(cols_at_size_);
|
|
178
|
+
$5vyXB$solidjs.createEffect(() => {
|
|
179
|
+
const incoming_value = incoming_content_blocks();
|
|
180
|
+
if (!incoming_value) {
|
|
181
|
+
set_content_blocks([]);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
set_content_blocks($5vyXB$solidjsstore.reconcile(incoming_value, {
|
|
185
|
+
key: "content"
|
|
186
|
+
})); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const get_wrapped_blocks_ = $d92f338ba8f9da9b$var$wrap_blocks_in_div(content_blocks, n_cols_currently_showing_);
|
|
190
|
+
$5vyXB$solidjs.createComputed(() => {
|
|
191
|
+
// Update our styling if a content block forces some items that should be in the top row into a lower one, so we can generate margin-top declarations for them
|
|
192
|
+
const top_row_block = get_wrapped_blocks_()[0];
|
|
193
|
+
const blocks_in_top_row_taken = top_row_block?.span_columns;
|
|
194
|
+
if (blocks_in_top_row_taken == undefined) {
|
|
195
|
+
// Fall back to zero if no content block in top row, since then no blocks in top row are taken
|
|
196
|
+
set_top_row_shortened_by_(0);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
return $5vyXB$solidjs.createMemo(() => $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
203
|
+
wrapped_blocks_: get_wrapped_blocks_(),
|
|
204
|
+
n_cols_currently_showing_: n_cols_currently_showing_()
|
|
205
|
+
}).content_blocks_by_index_);
|
|
206
|
+
}
|
|
207
|
+
function $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
208
|
+
wrapped_blocks_: wrapped_blocks_,
|
|
209
|
+
n_cols_currently_showing_: n_cols_currently_showing_
|
|
210
|
+
}) {
|
|
211
|
+
// This computation should be quite cheap since it just moves around things into an array
|
|
212
|
+
const content_blocks_by_index_ = [];
|
|
213
|
+
const constructed_block_arrays = new WeakSet();
|
|
214
|
+
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
215
|
+
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
|
|
216
|
+
if (!n_cols_currently_showing_)
|
|
217
|
+
// Nope out of here if we don't know how many columns are showing
|
|
218
|
+
return {
|
|
219
|
+
content_blocks_by_index_: content_blocks_by_index_
|
|
220
|
+
};
|
|
221
|
+
for (let i = 0; i < wrapped_blocks_.length; i++) {
|
|
222
|
+
// i = row to show at
|
|
223
|
+
const block = wrapped_blocks_[i];
|
|
224
|
+
if (!block) continue; // Array can have holes/not defined places
|
|
225
|
+
const index_of_first_item_in_row = i * n_cols_currently_showing_;
|
|
226
|
+
const index_of_last_item_in_row = index_of_first_item_in_row + n_cols_currently_showing_;
|
|
227
|
+
const {
|
|
228
|
+
span_rows: span_rows,
|
|
229
|
+
position: position,
|
|
230
|
+
span_columns: span_columns
|
|
231
|
+
} = block; // span columns is already capped in the block wrapping step (wrap_blocks_in_div)
|
|
232
|
+
let target_index;
|
|
233
|
+
if (position === "left") target_index = index_of_first_item_in_row;else if (position === "right") target_index = index_of_last_item_in_row - span_columns;else if (position === "center") target_index = index_of_first_item_in_row + Math.floor((n_cols_currently_showing_ - span_columns) / 2);else throw new Error("Invalid position for content block - must be left, right or center: " + JSON.stringify(position));
|
|
234
|
+
// Calculate displacement of us by content blocks above us
|
|
235
|
+
let displacement_by_added_blocks = 0;
|
|
236
|
+
for (let j = 0; j < i; j++) {
|
|
237
|
+
const row = displaced_products_[j];
|
|
238
|
+
if (row === undefined) continue; // there were no blocks in this row
|
|
239
|
+
let displaced_items_in_row;
|
|
240
|
+
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
241
|
+
displaced_items_in_row = row.filter(item => item).length;
|
|
242
|
+
displaced_products_[j] = displaced_items_in_row;
|
|
243
|
+
}
|
|
244
|
+
displacement_by_added_blocks += displaced_items_in_row;
|
|
245
|
+
}
|
|
246
|
+
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
247
|
+
for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products_[i]?.[j])
|
|
248
|
+
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
249
|
+
displacement_by_added_blocks++;
|
|
250
|
+
// Add block to output array at the correct index
|
|
251
|
+
const final_target_index = target_index - displacement_by_added_blocks;
|
|
252
|
+
const existing_block = content_blocks_by_index_[final_target_index];
|
|
253
|
+
const block_content = block.content;
|
|
254
|
+
// 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
|
|
255
|
+
if (existing_block) {
|
|
256
|
+
if (constructed_block_arrays.has(existing_block))
|
|
257
|
+
// Only push to arrays we have created to not create funky bugs when there's an array in JSX.Element
|
|
258
|
+
existing_block.push(block_content);else {
|
|
259
|
+
const array = [existing_block, block_content];
|
|
260
|
+
constructed_block_arrays.add(array);
|
|
261
|
+
content_blocks_by_index_[final_target_index] = array;
|
|
262
|
+
}
|
|
263
|
+
} else content_blocks_by_index_[final_target_index] = block_content;
|
|
264
|
+
// Update displacement
|
|
265
|
+
for (let j = 0; j < span_rows; j++) {
|
|
266
|
+
const row = displaced_products_[i + j] ||= [];
|
|
267
|
+
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
272
|
+
displaced_products_: displaced_products_
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* 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.
|
|
277
|
+
* Then renders the content and wraps it into a div with the correct styling.
|
|
278
|
+
* Also caps span_columns to max available columns
|
|
279
|
+
*/
|
|
280
|
+
function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
281
|
+
const get_wrapped_blocks = $5vyXB$solidjs.mapArray(() => rendered_content_blocks, block => {
|
|
282
|
+
if (!block) return;
|
|
283
|
+
const final_span_columns = $5vyXB$solidjs.createMemo(() => Math.min(block.span_columns, max_span_columns() ?? Infinity));
|
|
284
|
+
// 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
|
|
285
|
+
const final_span_rows = $5vyXB$solidjs.createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
286
|
+
const [rendering_delayed, set_rendering_delayed_] = $5vyXB$solidjs.createSignal(true);
|
|
287
|
+
const content = $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
288
|
+
get when() {
|
|
289
|
+
return !rendering_delayed();
|
|
290
|
+
},
|
|
291
|
+
get children() {
|
|
292
|
+
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, {
|
|
293
|
+
get content() {
|
|
294
|
+
return block.content;
|
|
295
|
+
}
|
|
296
|
+
})));
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
return $5vyXB$solidjs.mergeProps(block, {
|
|
300
|
+
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
301
|
+
content: () => {
|
|
302
|
+
// Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
|
|
303
|
+
// However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
|
|
304
|
+
set_rendering_delayed_(false);
|
|
305
|
+
return content;
|
|
306
|
+
},
|
|
307
|
+
get span_columns() {
|
|
308
|
+
// Cap max width of block to the number of columns available, for everyone downstream
|
|
309
|
+
return final_span_columns();
|
|
310
|
+
},
|
|
311
|
+
get span_rows() {
|
|
312
|
+
return final_span_rows();
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
return get_wrapped_blocks;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Basically adds support for async content block functions and shows a rudimentary placeholder if rendering is delayed. Required due to react having a rendering delay.
|
|
320
|
+
*/
|
|
321
|
+
function $d92f338ba8f9da9b$var$RenderContent(props) {
|
|
322
|
+
const [resource] = $5vyXB$solidjs.createResource(() => props.content,
|
|
323
|
+
// Could be reactive
|
|
324
|
+
fn => fn());
|
|
325
|
+
$5vyXB$solidjs.createEffect(() => {
|
|
326
|
+
if (resource.error) console.error("Error in content block rendering", resource.error);
|
|
327
|
+
});
|
|
328
|
+
// The suspense is for when there's an async content block (which we have to support due to react having a rendering delay) so that we can show some height while it's loading (should kinda never be visible)
|
|
329
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
|
|
330
|
+
get fallback() {
|
|
331
|
+
return $5vyXB$solidjsweb.createComponent((0, $3bc4a89b971a3af5$export$3f37af283f8fb843), {
|
|
332
|
+
width: "100%",
|
|
333
|
+
height: "max(100%, 400px)"
|
|
334
|
+
});
|
|
335
|
+
},
|
|
336
|
+
children: resource
|
|
337
|
+
});
|
|
338
|
+
}
|
|
108
339
|
let $8bf678c45948a297$var$elementsHoveredSignal;
|
|
109
340
|
let $8bf678c45948a297$var$consumersSignal;
|
|
110
341
|
function $8bf678c45948a297$export$d4d96868197be50e() {
|
|
@@ -1009,49 +1240,6 @@ function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
|
|
|
1009
1240
|
function $84798aaa863a4909$export$8d0c4fdbb05a2f2e() {
|
|
1010
1241
|
return $5vyXB$solidjs.useContext($84798aaa863a4909$var$ListingContext);
|
|
1011
1242
|
}
|
|
1012
|
-
var $9fe9883b1d8ecccc$var$_tmpl$ = ["<span", ' class="', '" style="', '"></span>'];
|
|
1013
|
-
function $9fe9883b1d8ecccc$export$acb3eaade4b23afd(props) {
|
|
1014
|
-
// Work around https://github.com/solidjs/solid/issues/1980
|
|
1015
|
-
return $5vyXB$solidjsweb.ssr($9fe9883b1d8ecccc$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), `${$5vyXB$solidjsweb.escape(props.class, true) || ""} depict-placeholder`, $5vyXB$solidjsweb.ssrStyle(props.style));
|
|
1016
|
-
}
|
|
1017
|
-
function $3bc4a89b971a3af5$export$3f37af283f8fb843(props) {
|
|
1018
|
-
const style = $5vyXB$solidjs.createMemo(() => {
|
|
1019
|
-
const {
|
|
1020
|
-
style: style,
|
|
1021
|
-
height: height,
|
|
1022
|
-
width: width,
|
|
1023
|
-
aspectRatio: aspectRatio
|
|
1024
|
-
} = props;
|
|
1025
|
-
const is_image = aspectRatio != undefined;
|
|
1026
|
-
const size_data = is_image ? {
|
|
1027
|
-
width: "100%",
|
|
1028
|
-
"padding-bottom": `calc(calc(1 / ${aspectRatio}) * 100%)`
|
|
1029
|
-
} : {
|
|
1030
|
-
width: width,
|
|
1031
|
-
height: height
|
|
1032
|
-
};
|
|
1033
|
-
return {
|
|
1034
|
-
display: "block",
|
|
1035
|
-
...(style || {}),
|
|
1036
|
-
...size_data
|
|
1037
|
-
};
|
|
1038
|
-
});
|
|
1039
|
-
return $5vyXB$solidjsweb.createComponent((0, $9fe9883b1d8ecccc$export$acb3eaade4b23afd), {
|
|
1040
|
-
get style() {
|
|
1041
|
-
return style();
|
|
1042
|
-
},
|
|
1043
|
-
get ["class"]() {
|
|
1044
|
-
return props.class;
|
|
1045
|
-
}
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
|
|
1049
|
-
const signal = $5vyXB$solidjs.createSignal(false);
|
|
1050
|
-
$5vyXB$solidjs.onCleanup($5vyXB$depictaiutilishared.javascript_media_query(media_query, ({
|
|
1051
|
-
matches: matches
|
|
1052
|
-
}) => signal[1](matches)).remove);
|
|
1053
|
-
return signal[0];
|
|
1054
|
-
}
|
|
1055
1243
|
function $061ff5b4c3d36171$export$89c6019e4baa40b1(props) {
|
|
1056
1244
|
const style = $5vyXB$solidjs.createMemo(() => {
|
|
1057
1245
|
const {
|
|
@@ -7943,7 +8131,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
7943
8131
|
breadcrumbs: [],
|
|
7944
8132
|
quick_links: [],
|
|
7945
8133
|
image_urls: [],
|
|
7946
|
-
failed: true
|
|
8134
|
+
failed: true,
|
|
8135
|
+
content_blocks: []
|
|
7947
8136
|
}),
|
|
7948
8137
|
method_: "GET"
|
|
7949
8138
|
});
|
|
@@ -9205,196 +9394,6 @@ function $738c3a81fc46a340$export$cb5808ba002cdeed({
|
|
|
9205
9394
|
}) : when_filters_closed_cols;
|
|
9206
9395
|
});
|
|
9207
9396
|
}
|
|
9208
|
-
function $17d06b3bcb035500$export$a79e666719b3647c(cols_at_size_) {
|
|
9209
|
-
const size_active = $5vyXB$solidjs.createMemo(() => cols_at_size_().map(([n_cols, min_width, max_width]) => {
|
|
9210
|
-
const media_query = $5vyXB$depictaiutilishared.layout_media_query_header(min_width, max_width).replaceAll("@media", "");
|
|
9211
|
-
const matches = $b54e6192d0caa293$export$d9f36cf74e24d595(media_query);
|
|
9212
|
-
return [matches, n_cols];
|
|
9213
|
-
}));
|
|
9214
|
-
const n_cols_currently_showing = $5vyXB$solidjs.createMemo(() => {
|
|
9215
|
-
try {
|
|
9216
|
-
const [, n_cols_currently_showing] = size_active().find(([media_query]) => media_query());
|
|
9217
|
-
return n_cols_currently_showing;
|
|
9218
|
-
} catch (e) {
|
|
9219
|
-
$5vyXB$depictaiutilishared.dwarn("No active size found in columnsAtSize - can't render content blocks or looks");
|
|
9220
|
-
return null;
|
|
9221
|
-
}
|
|
9222
|
-
});
|
|
9223
|
-
return n_cols_currently_showing;
|
|
9224
|
-
}
|
|
9225
|
-
var $d92f338ba8f9da9b$var$_tmpl$ = ["<div", ' class="content-block-wrapper" style="', '">', "</div>"];
|
|
9226
|
-
function $d92f338ba8f9da9b$export$791ef57e62e21c3f({
|
|
9227
|
-
content_blocks_: incoming_content_blocks,
|
|
9228
|
-
cols_at_size_: cols_at_size_,
|
|
9229
|
-
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
9230
|
-
}) {
|
|
9231
|
-
// these are by row
|
|
9232
|
-
const [content_blocks, set_content_blocks] = $5vyXB$solidjsstore.createStore([]);
|
|
9233
|
-
const n_cols_currently_showing_ = $17d06b3bcb035500$export$a79e666719b3647c(cols_at_size_);
|
|
9234
|
-
$5vyXB$solidjs.createEffect(() => {
|
|
9235
|
-
const incoming_value = incoming_content_blocks();
|
|
9236
|
-
if (!incoming_value) {
|
|
9237
|
-
set_content_blocks([]);
|
|
9238
|
-
return;
|
|
9239
|
-
}
|
|
9240
|
-
set_content_blocks($5vyXB$solidjsstore.reconcile(incoming_value, {
|
|
9241
|
-
key: "content"
|
|
9242
|
-
})); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
|
|
9243
|
-
});
|
|
9244
|
-
|
|
9245
|
-
const get_wrapped_blocks_ = $d92f338ba8f9da9b$var$wrap_blocks_in_div(content_blocks, n_cols_currently_showing_);
|
|
9246
|
-
$5vyXB$solidjs.createComputed(() => {
|
|
9247
|
-
// Update our styling if a content block forces some items that should be in the top row into a lower one, so we can generate margin-top declarations for them
|
|
9248
|
-
const top_row_block = get_wrapped_blocks_()[0];
|
|
9249
|
-
const blocks_in_top_row_taken = top_row_block?.span_columns;
|
|
9250
|
-
if (blocks_in_top_row_taken == undefined) {
|
|
9251
|
-
// Fall back to zero if no content block in top row, since then no blocks in top row are taken
|
|
9252
|
-
set_top_row_shortened_by_(0);
|
|
9253
|
-
return;
|
|
9254
|
-
}
|
|
9255
|
-
set_top_row_shortened_by_(blocks_in_top_row_taken - 1); // minus one because the content block wrapper also is an element
|
|
9256
|
-
});
|
|
9257
|
-
|
|
9258
|
-
return $d92f338ba8f9da9b$var$remap_blocks_to_index({
|
|
9259
|
-
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
9260
|
-
n_cols_currently_showing_: n_cols_currently_showing_
|
|
9261
|
-
});
|
|
9262
|
-
}
|
|
9263
|
-
/**
|
|
9264
|
-
* Calculate where to put each of the finished wrapped content blocks. Also limit blocks' max width.
|
|
9265
|
-
* @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
|
|
9266
|
-
*/
|
|
9267
|
-
function $d92f338ba8f9da9b$var$remap_blocks_to_index({
|
|
9268
|
-
get_wrapped_blocks_: get_wrapped_blocks_,
|
|
9269
|
-
n_cols_currently_showing_: n_cols_currently_showing_
|
|
9270
|
-
}) {
|
|
9271
|
-
return $5vyXB$solidjs.createMemo(() => {
|
|
9272
|
-
// This computation should be quite cheap since it just moves around things into an array
|
|
9273
|
-
const content_blocks_by_index = [];
|
|
9274
|
-
const constructed_block_arrays = new WeakSet();
|
|
9275
|
-
const wrapped_blocks = get_wrapped_blocks_();
|
|
9276
|
-
const cols_showing = n_cols_currently_showing_();
|
|
9277
|
-
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
9278
|
-
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
|
|
9279
|
-
if (!cols_showing)
|
|
9280
|
-
// Nope out of here if we don't know how many columns are showing
|
|
9281
|
-
return content_blocks_by_index;
|
|
9282
|
-
for (let i = 0; i < wrapped_blocks.length; i++) {
|
|
9283
|
-
// i = row to show at
|
|
9284
|
-
const block = wrapped_blocks[i];
|
|
9285
|
-
if (!block) continue; // Array can have holes/not defined places
|
|
9286
|
-
const index_of_first_item_in_row = i * cols_showing;
|
|
9287
|
-
const index_of_last_item_in_row = index_of_first_item_in_row + cols_showing;
|
|
9288
|
-
const {
|
|
9289
|
-
span_rows: span_rows,
|
|
9290
|
-
position: position,
|
|
9291
|
-
span_columns: span_columns
|
|
9292
|
-
} = block; // span columns is already capped in the block wrapping step (wrap_blocks_in_div)
|
|
9293
|
-
let target_index;
|
|
9294
|
-
if (position === "left") target_index = index_of_first_item_in_row;else if (position === "right") target_index = index_of_last_item_in_row - span_columns;else if (position === "center") target_index = index_of_first_item_in_row + Math.floor((cols_showing - span_columns) / 2);else throw new Error("Invalid position for content block - must be left, right or center: " + JSON.stringify(position));
|
|
9295
|
-
// Calculate displacement of us by content blocks above us
|
|
9296
|
-
let displacement_by_added_blocks = 0;
|
|
9297
|
-
for (let j = 0; j < i; j++) {
|
|
9298
|
-
const row = displaced_products[j];
|
|
9299
|
-
if (row === undefined) continue; // there were no blocks in this row
|
|
9300
|
-
let displaced_items_in_row;
|
|
9301
|
-
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
9302
|
-
displaced_items_in_row = row.filter(item => item).length;
|
|
9303
|
-
displaced_products[j] = displaced_items_in_row;
|
|
9304
|
-
}
|
|
9305
|
-
displacement_by_added_blocks += displaced_items_in_row;
|
|
9306
|
-
}
|
|
9307
|
-
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
9308
|
-
for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products[i]?.[j])
|
|
9309
|
-
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
9310
|
-
displacement_by_added_blocks++;
|
|
9311
|
-
// Add block to output array at the correct index
|
|
9312
|
-
const final_target_index = target_index - displacement_by_added_blocks;
|
|
9313
|
-
const existing_block = content_blocks_by_index[final_target_index];
|
|
9314
|
-
const block_content = block.content;
|
|
9315
|
-
// 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
|
|
9316
|
-
if (existing_block) {
|
|
9317
|
-
if (constructed_block_arrays.has(existing_block))
|
|
9318
|
-
// Only push to arrays we have created to not create funky bugs when there's an array in JSX.Element
|
|
9319
|
-
existing_block.push(block_content);else {
|
|
9320
|
-
const array = [existing_block, block_content];
|
|
9321
|
-
constructed_block_arrays.add(array);
|
|
9322
|
-
content_blocks_by_index[final_target_index] = array;
|
|
9323
|
-
}
|
|
9324
|
-
} else content_blocks_by_index[final_target_index] = block_content;
|
|
9325
|
-
// Update displacement
|
|
9326
|
-
for (let j = 0; j < span_rows; j++) {
|
|
9327
|
-
const row = displaced_products[i + j] ||= [];
|
|
9328
|
-
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
9329
|
-
}
|
|
9330
|
-
}
|
|
9331
|
-
return content_blocks_by_index;
|
|
9332
|
-
});
|
|
9333
|
-
}
|
|
9334
|
-
/**
|
|
9335
|
-
* 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.
|
|
9336
|
-
* Then renders the content and wraps it into a div with the correct styling.
|
|
9337
|
-
* Also caps span_columns to max available columns
|
|
9338
|
-
*/
|
|
9339
|
-
function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_span_columns) {
|
|
9340
|
-
const get_wrapped_blocks = $5vyXB$solidjs.mapArray(() => rendered_content_blocks, block => {
|
|
9341
|
-
if (!block) return;
|
|
9342
|
-
const final_span_columns = $5vyXB$solidjs.createMemo(() => Math.min(block.span_columns, max_span_columns() ?? Infinity));
|
|
9343
|
-
// 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
|
|
9344
|
-
const final_span_rows = $5vyXB$solidjs.createMemo(() => final_span_columns() === max_span_columns() ? 1 : block.span_rows);
|
|
9345
|
-
const [rendering_delayed, set_rendering_delayed_] = $5vyXB$solidjs.createSignal(true);
|
|
9346
|
-
const content = $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
9347
|
-
get when() {
|
|
9348
|
-
return !rendering_delayed();
|
|
9349
|
-
},
|
|
9350
|
-
get children() {
|
|
9351
|
-
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, {
|
|
9352
|
-
get content() {
|
|
9353
|
-
return block.content;
|
|
9354
|
-
}
|
|
9355
|
-
})));
|
|
9356
|
-
}
|
|
9357
|
-
});
|
|
9358
|
-
return $5vyXB$solidjs.mergeProps(block, {
|
|
9359
|
-
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
9360
|
-
content: () => {
|
|
9361
|
-
// Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
|
|
9362
|
-
// However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
|
|
9363
|
-
set_rendering_delayed_(false);
|
|
9364
|
-
return content;
|
|
9365
|
-
},
|
|
9366
|
-
get span_columns() {
|
|
9367
|
-
// Cap max width of block to the number of columns available, for everyone downstream
|
|
9368
|
-
return final_span_columns();
|
|
9369
|
-
},
|
|
9370
|
-
get span_rows() {
|
|
9371
|
-
return final_span_rows();
|
|
9372
|
-
}
|
|
9373
|
-
});
|
|
9374
|
-
});
|
|
9375
|
-
return get_wrapped_blocks;
|
|
9376
|
-
}
|
|
9377
|
-
/**
|
|
9378
|
-
* Basically adds support for async content block functions and shows a rudimentary placeholder if rendering is delayed. Required due to react having a rendering delay.
|
|
9379
|
-
*/
|
|
9380
|
-
function $d92f338ba8f9da9b$var$RenderContent(props) {
|
|
9381
|
-
const [resource] = $5vyXB$solidjs.createResource(() => props.content,
|
|
9382
|
-
// Could be reactive
|
|
9383
|
-
fn => fn());
|
|
9384
|
-
$5vyXB$solidjs.createEffect(() => {
|
|
9385
|
-
if (resource.error) console.error("Error in content block rendering", resource.error);
|
|
9386
|
-
});
|
|
9387
|
-
// The suspense is for when there's an async content block (which we have to support due to react having a rendering delay) so that we can show some height while it's loading (should kinda never be visible)
|
|
9388
|
-
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
|
|
9389
|
-
get fallback() {
|
|
9390
|
-
return $5vyXB$solidjsweb.createComponent((0, $3bc4a89b971a3af5$export$3f37af283f8fb843), {
|
|
9391
|
-
width: "100%",
|
|
9392
|
-
height: "max(100%, 400px)"
|
|
9393
|
-
});
|
|
9394
|
-
},
|
|
9395
|
-
children: resource
|
|
9396
|
-
});
|
|
9397
|
-
}
|
|
9398
9397
|
var $fe76fb463cc60b89$var$_tmpl$ = ["<div", ' class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"];
|
|
9399
9398
|
function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
9400
9399
|
plp_results_: plp_results_,
|
|
@@ -12335,6 +12334,15 @@ function $ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_
|
|
|
12335
12334
|
});
|
|
12336
12335
|
tracking_function_for_plp_results(plp_results_);
|
|
12337
12336
|
}
|
|
12337
|
+
var $32c662f618f5d80d$var$_tmpl$ = ["<a", "><img", ' style="', '"></a>'],
|
|
12338
|
+
$32c662f618f5d80d$var$_tmpl$2 = ["<a", "><video", ' muted="" autoplay="" playsinline="" loop style="', '"></video></a>'];
|
|
12339
|
+
function $32c662f618f5d80d$export$780a853d15174484({
|
|
12340
|
+
contentBlock: contentBlock,
|
|
12341
|
+
router_: router_
|
|
12342
|
+
}) {
|
|
12343
|
+
if (contentBlock.content.type === "image") return () => $5vyXB$solidjsweb.ssr($32c662f618f5d80d$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey() + $5vyXB$solidjsweb.ssrAttribute("href", $5vyXB$solidjsweb.escape(contentBlock.content.link, true), false), $5vyXB$solidjsweb.ssrAttribute("src", $5vyXB$solidjsweb.escape(contentBlock.content.url, true), false), "width:100%;height:100%;object-fit:cover;position:absolute;inset:0");
|
|
12344
|
+
if (contentBlock.content.type === "video") return () => $5vyXB$solidjsweb.ssr($32c662f618f5d80d$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey() + $5vyXB$solidjsweb.ssrAttribute("href", $5vyXB$solidjsweb.escape(contentBlock.content.link, true), false), $5vyXB$solidjsweb.ssrAttribute("src", $5vyXB$solidjsweb.escape(contentBlock.content.url, true), false), "width:100%;height:100%;object-fit:cover;position:absolute;inset:0");
|
|
12345
|
+
}
|
|
12338
12346
|
var $840d88a04b2d22a7$var$_tmpl$ = ["<div", ' class="product-count"><!--$-->', "<!--/--> <!--$-->", "<!--/--></div>"],
|
|
12339
12347
|
$840d88a04b2d22a7$var$_tmpl$2 = ["<div", "></div>"],
|
|
12340
12348
|
$840d88a04b2d22a7$var$_tmpl$3 = ["<div", ' class="filter-results-for-one-row"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
@@ -12430,6 +12438,23 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
12430
12438
|
}));
|
|
12431
12439
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
12432
12440
|
const [plp_meta] = $5vyXB$solidjs.createResource(meta_query_base, $5vyXB$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
|
|
12441
|
+
const contentBlocksByRow = $5vyXB$solidjs.createMemo(() => {
|
|
12442
|
+
if (content_blocks_by_row_()) return content_blocks_by_row_();
|
|
12443
|
+
const content = [];
|
|
12444
|
+
plp_meta()?.content_blocks?.forEach(row => {
|
|
12445
|
+
const contentBlock = {
|
|
12446
|
+
span_columns: row.span_columns,
|
|
12447
|
+
span_rows: row.span_rows,
|
|
12448
|
+
position: row.position,
|
|
12449
|
+
content: $32c662f618f5d80d$export$780a853d15174484({
|
|
12450
|
+
contentBlock: row,
|
|
12451
|
+
router_: router_
|
|
12452
|
+
})
|
|
12453
|
+
};
|
|
12454
|
+
content[row.row] = contentBlock;
|
|
12455
|
+
});
|
|
12456
|
+
return content;
|
|
12457
|
+
});
|
|
12433
12458
|
const available_sortings_ = $5vyXB$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
|
|
12434
12459
|
...sort,
|
|
12435
12460
|
order: sort.order ?? "desc"
|
|
@@ -12648,7 +12673,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
12648
12673
|
product_card_template_: product_card_template_,
|
|
12649
12674
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
12650
12675
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
12651
|
-
content_blocks_by_row_:
|
|
12676
|
+
content_blocks_by_row_: contentBlocksByRow,
|
|
12652
12677
|
ConfiguredScrollStatus_: ConfiguredScrollStatus_,
|
|
12653
12678
|
id_currently_querying_for_: id_to_query_for_,
|
|
12654
12679
|
no_results_options_: {
|