@depict-ai/ui 4.7.13 → 4.7.15
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 +332 -253
- package/ES10/index.d.ts +27 -23
- package/ES10/index.js +334 -256
- package/latest/index.cjs +314 -237
- package/latest/index.d.ts +27 -23
- package/latest/index.js +316 -240
- package/package.json +2 -2
- package/server/ES10/index.cjs +332 -253
- package/server/ES10/index.d.ts +27 -23
- package/server/ES10/index.js +334 -256
- package/server/latest/index.cjs +314 -237
- package/server/latest/index.d.ts +27 -23
- package/server/latest/index.js +316 -240
package/server/ES10/index.cjs
CHANGED
|
@@ -18,6 +18,7 @@ function $parcel$export(e, n, v, s) {
|
|
|
18
18
|
function $parcel$interopDefault(a) {
|
|
19
19
|
return a && a.__esModule ? a.default : a;
|
|
20
20
|
}
|
|
21
|
+
$parcel$export(module.exports, "useProductCardIsVisible", () => $a52942afacbced93$export$80bb7300ce6a8be3);
|
|
21
22
|
$parcel$export(module.exports, "useExpandingContainerReactive", () => $d6d51b09cb2116a6$export$5bad61ecde080b1f);
|
|
22
23
|
$parcel$export(module.exports, "LooksSliderOrGrid", () => $e57cd46536ad992e$export$2c9f9bf2092486aa);
|
|
23
24
|
$parcel$export(module.exports, "LookCard", () => $47e3c3102c78121b$export$44809a8a3e867e30);
|
|
@@ -104,78 +105,18 @@ $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7
|
|
|
104
105
|
$parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
|
|
105
106
|
$parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
|
|
106
107
|
/*! Depict.ai search and product listing SDK */
|
|
107
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.7.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
expand: expand,
|
|
117
|
-
ExpandingContainer: _ref => {
|
|
118
|
-
let {
|
|
119
|
-
children: children
|
|
120
|
-
} = _ref;
|
|
121
|
-
// get reactive signals/solid's jsx elements into `ExpandingContainer`
|
|
122
|
-
const fake_div = document.createElement("div");
|
|
123
|
-
const outer_expanding = $3hooq$solidjsweb.createComponent(ExpandingContainer, {
|
|
124
|
-
children: [fake_div]
|
|
125
|
-
});
|
|
126
|
-
const parent = fake_div.parentElement;
|
|
127
|
-
fake_div.remove();
|
|
128
|
-
$3hooq$solidjsweb.insert(parent, children);
|
|
129
|
-
return outer_expanding;
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
const $5401a6698b0c0658$var$transform_elements = sorted_cols_at_size => {
|
|
134
|
-
const cols_at_size = [];
|
|
135
|
-
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
136
|
-
var _sorted_cols_at_size;
|
|
137
|
-
const [nb_cols, width] = sorted_cols_at_size[i];
|
|
138
|
-
const next_width = (_sorted_cols_at_size = sorted_cols_at_size[i + 1]) === null || _sorted_cols_at_size === void 0 ? void 0 : _sorted_cols_at_size[1];
|
|
139
|
-
const max_width = i === 0 ? "" : "".concat(width, "px");
|
|
140
|
-
const min_width = next_width !== undefined ? "".concat(next_width + 1, "px") : "";
|
|
141
|
-
const col_at_size = [nb_cols, min_width, max_width];
|
|
142
|
-
cols_at_size.push(col_at_size);
|
|
143
|
-
}
|
|
144
|
-
return cols_at_size;
|
|
145
|
-
};
|
|
146
|
-
const $5401a6698b0c0658$export$6daf8749b65a1b77 = cols_at_size => {
|
|
147
|
-
var _cols_at_size$every;
|
|
148
|
-
// Check that every element is an array
|
|
149
|
-
const are_arrays = cols_at_size === null || cols_at_size === void 0 ? void 0 : (_cols_at_size$every = cols_at_size.every) === null || _cols_at_size$every === void 0 ? void 0 : _cols_at_size$every.call(cols_at_size, element => Array.isArray(element));
|
|
150
|
-
if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
|
|
151
|
-
// Check width duplicates
|
|
152
|
-
const widths = cols_at_size.map(_ref => {
|
|
153
|
-
let [_, width] = _ref;
|
|
154
|
-
return width;
|
|
155
|
-
});
|
|
156
|
-
const widths_set = new Set(widths);
|
|
157
|
-
if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
|
|
158
|
-
if (cols_at_size.length === 1) {
|
|
159
|
-
const [nb_cols, width] = cols_at_size[0];
|
|
160
|
-
const max_width = width !== undefined ? "".concat(width, "px") : "";
|
|
161
|
-
return [[nb_cols, "", max_width]];
|
|
108
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.7.15";
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Gets product_id (the thing we key the rendering on) from a display
|
|
112
|
+
*/
|
|
113
|
+
function $b85edfec41cd3989$export$548d053aba053d79(display) {
|
|
114
|
+
if ("variant_index" in display) {
|
|
115
|
+
const actual_display = display.variant_displays[display.variant_index];
|
|
116
|
+
return actual_display.product_id;
|
|
162
117
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const [_b, width_A] = a;
|
|
166
|
-
const [_a, width_b] = b;
|
|
167
|
-
if (width_A === undefined) return -1;
|
|
168
|
-
if (width_b === undefined) return 1;
|
|
169
|
-
return width_b - width_A;
|
|
170
|
-
});
|
|
171
|
-
return $5401a6698b0c0658$var$transform_elements(sorted_cols_at_size);
|
|
172
|
-
};
|
|
173
|
-
function $8edd3cf30d1fd8b4$export$a2cc176055f8f08() {
|
|
174
|
-
let what = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "grid";
|
|
175
|
-
const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the " + what + " before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
|
|
176
|
-
return (0, $3hooq$solidjsweb.isServer) ? {
|
|
177
|
-
t: "<!-- ".concat(text, " -->")
|
|
178
|
-
} : document.createComment(text);
|
|
118
|
+
if ("listing_id" in display) return display.listing_id;
|
|
119
|
+
return display.product_id;
|
|
179
120
|
}
|
|
180
121
|
function $e82d0d417fa613e8$export$2f0cbfbb4354bb52(elements) {
|
|
181
122
|
// FYI this probably doesn't work on hugely deep nestings or large amount of elements
|
|
@@ -189,121 +130,6 @@ function $e82d0d417fa613e8$var$unwrapping_helper(elements) {
|
|
|
189
130
|
} else if (typeof elements == "function") result.push(...$e82d0d417fa613e8$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
|
|
190
131
|
return result;
|
|
191
132
|
}
|
|
192
|
-
let $e3915574cfd3466c$var$cached_placeholder_element;
|
|
193
|
-
let $e3915574cfd3466c$var$rendering_cached_placeholder_element;
|
|
194
|
-
function $e3915574cfd3466c$export$f33414a4df0afd3f(_ref) {
|
|
195
|
-
let {
|
|
196
|
-
product_card_template_: product_card_template_,
|
|
197
|
-
num_placeholders_: num_placeholders_,
|
|
198
|
-
content_blocks_: content_blocks_
|
|
199
|
-
} = _ref;
|
|
200
|
-
const [num_to_actually_show, set_num_to_actually_show] = $3hooq$solidjs.createSignal($3hooq$solidjs.untrack(num_placeholders_));
|
|
201
|
-
if (0, $3hooq$solidjsweb.isServer)
|
|
202
|
-
// want to render simple placeholders on server, effects don't run there
|
|
203
|
-
// FIXME when adding proper SSR: also SSR content blocks
|
|
204
|
-
return $3hooq$solidjs.createMemo(() => Array.from({
|
|
205
|
-
length: num_placeholders_()
|
|
206
|
-
}).map(() => {
|
|
207
|
-
const template_result = product_card_template_(null, undefined);
|
|
208
|
-
// @ts-ignore
|
|
209
|
-
if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
|
|
210
|
-
}));
|
|
211
|
-
$3hooq$solidjs.createRenderEffect(() => {
|
|
212
|
-
const existing_num = num_to_actually_show();
|
|
213
|
-
const to_add = num_placeholders_() - existing_num;
|
|
214
|
-
if (to_add <= 0) return;
|
|
215
|
-
// Below comment is from when we used recommendation renderer and manual DOM manipulation for this, but I'm still scared to remove placeholders and mess up scroll restoration, so I'm keeping the way it worked. Otherwise, <Index> could be used which would be far more elegant.
|
|
216
|
-
// We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
|
|
217
|
-
// The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
|
|
218
|
-
// Above comments were from when we added elements in this createRenderEffect. Now I changed it to just increment the number and render them from an <Index> instead, so I can add content blocks better
|
|
219
|
-
// Functionality should be the same
|
|
220
|
-
set_num_to_actually_show(existing_num + to_add);
|
|
221
|
-
});
|
|
222
|
-
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Index), {
|
|
223
|
-
get each() {
|
|
224
|
-
return Array.from({
|
|
225
|
-
length: num_to_actually_show()
|
|
226
|
-
});
|
|
227
|
-
},
|
|
228
|
-
children: (_item, index) => {
|
|
229
|
-
const possible_content_block = $3hooq$solidjs.createMemo(() => {
|
|
230
|
-
var _content_blocks_, _content_blocks_2;
|
|
231
|
-
return content_blocks_ === null || content_blocks_ === void 0 ? void 0 : (_content_blocks_ = content_blocks_()) === null || _content_blocks_ === void 0 ? void 0 : (_content_blocks_2 = _content_blocks_()) === null || _content_blocks_2 === void 0 ? void 0 : _content_blocks_2[index];
|
|
232
|
-
});
|
|
233
|
-
// Show content block before product card, so it's *at* that index
|
|
234
|
-
return [possible_content_block, $e3915574cfd3466c$var$Placeholder({
|
|
235
|
-
product_card_template_: product_card_template_
|
|
236
|
-
})]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
242
|
-
*/
|
|
243
|
-
function $e3915574cfd3466c$var$Placeholder(_ref2) {
|
|
244
|
-
let {
|
|
245
|
-
product_card_template_: product_card_template_
|
|
246
|
-
} = _ref2;
|
|
247
|
-
const get_cloned_placeholders = function () {
|
|
248
|
-
let element_to_clone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $e3915574cfd3466c$var$cached_placeholder_element;
|
|
249
|
-
return Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
|
|
250
|
-
};
|
|
251
|
-
if ($e3915574cfd3466c$var$cached_placeholder_element) return get_cloned_placeholders();
|
|
252
|
-
let dispose_original_copy;
|
|
253
|
-
const get_unwrapped_element = $3hooq$solidjs.createRoot(dispose => {
|
|
254
|
-
dispose_original_copy = dispose;
|
|
255
|
-
// if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
|
|
256
|
-
const [resource] = $3hooq$solidjs.createResource(() => {
|
|
257
|
-
if ($e3915574cfd3466c$var$rendering_cached_placeholder_element) return $e3915574cfd3466c$var$rendering_cached_placeholder_element;
|
|
258
|
-
const return_value = product_card_template_(null, undefined);
|
|
259
|
-
if (typeof return_value === "object" && typeof (return_value === null || return_value === void 0 ? void 0 : return_value.then) === "function")
|
|
260
|
-
// Is Promise or promise-like object
|
|
261
|
-
$e3915574cfd3466c$var$rendering_cached_placeholder_element = return_value;
|
|
262
|
-
return return_value;
|
|
263
|
-
});
|
|
264
|
-
return $3hooq$solidjs.createMemo(() => {
|
|
265
|
-
if (resource.loading) return () => [];
|
|
266
|
-
return $e82d0d417fa613e8$export$2f0cbfbb4354bb52(resource);
|
|
267
|
-
});
|
|
268
|
-
});
|
|
269
|
-
$3hooq$solidjs.onCleanup(() => {
|
|
270
|
-
if ($e3915574cfd3466c$var$rendering_cached_placeholder_element) {
|
|
271
|
-
var _rendering_cached_pla;
|
|
272
|
-
// If we're still rendering in our separate root, let the rendering finish or other <Placeholder> components waiting for it might get an incomplete result
|
|
273
|
-
const unset_current_rendering = () => {
|
|
274
|
-
dispose_original_copy();
|
|
275
|
-
$e3915574cfd3466c$var$rendering_cached_placeholder_element = undefined;
|
|
276
|
-
};
|
|
277
|
-
(_rendering_cached_pla = $e3915574cfd3466c$var$rendering_cached_placeholder_element) === null || _rendering_cached_pla === void 0 || _rendering_cached_pla.then(unset_current_rendering, unset_current_rendering);
|
|
278
|
-
} else
|
|
279
|
-
// Otherwise, just make sure we've disposed our root
|
|
280
|
-
dispose_original_copy();
|
|
281
|
-
});
|
|
282
|
-
return $3hooq$solidjs.createMemo(() => {
|
|
283
|
-
const unwrapped_array = get_unwrapped_element()();
|
|
284
|
-
if (!(unwrapped_array !== null && unwrapped_array !== void 0 && unwrapped_array.length) || !unwrapped_array.every(item => item))
|
|
285
|
-
// Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
|
|
286
|
-
return;
|
|
287
|
-
// placeholders have finished rendering, freeze the elements
|
|
288
|
-
// here we might receive the result of a promise that has already been received, tore down and put into cached_placeholder_element, so don't overwrite that more valid result if it's already set
|
|
289
|
-
$e3915574cfd3466c$var$cached_placeholder_element || ($e3915574cfd3466c$var$cached_placeholder_element = get_cloned_placeholders(unwrapped_array)); // Clone initial return value so that who gave us the elements can't mutate them, which has caused issues before with react
|
|
290
|
-
$e3915574cfd3466c$var$rendering_cached_placeholder_element = undefined;
|
|
291
|
-
dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
|
|
292
|
-
return get_cloned_placeholders(); // clone, just in case. If we wouldn't, someone could modify the copy in the DOM, and it would affect the cached version
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Gets product_id (the thing we key the rendering on) from a display
|
|
298
|
-
*/
|
|
299
|
-
function $b85edfec41cd3989$export$548d053aba053d79(display) {
|
|
300
|
-
if ("variant_index" in display) {
|
|
301
|
-
const actual_display = display.variant_displays[display.variant_index];
|
|
302
|
-
return actual_display.product_id;
|
|
303
|
-
}
|
|
304
|
-
if ("listing_id" in display) return display.listing_id;
|
|
305
|
-
return display.product_id;
|
|
306
|
-
}
|
|
307
133
|
const $b54645378dfc7280$var$ProductCardIndexContext = /*@__PURE__*/$3hooq$solidjs.createContext();
|
|
308
134
|
function $b54645378dfc7280$export$11354f017ddc9790(props) {
|
|
309
135
|
return $3hooq$solidjsweb.createComponent($b54645378dfc7280$var$ProductCardIndexContext.Provider, {
|
|
@@ -521,6 +347,266 @@ function $76012c4468a53d1f$var$deep_equal(obj1, obj2) {
|
|
|
521
347
|
}
|
|
522
348
|
return true;
|
|
523
349
|
}
|
|
350
|
+
const $a52942afacbced93$var$CurrentlyIntersectingContext = /*@__PURE__*/$3hooq$solidjs.createContext();
|
|
351
|
+
function $a52942afacbced93$export$4a14175d33d81a96(_ref) {
|
|
352
|
+
let {
|
|
353
|
+
displays_by_key_: displays_by_key_,
|
|
354
|
+
product_card_template_: product_card_template_,
|
|
355
|
+
content_blocks_: content_blocks_,
|
|
356
|
+
alwaysObserveCards_: alwaysObserveCards_
|
|
357
|
+
} = _ref;
|
|
358
|
+
// The following sets up an intersection observer to determine which results are in the viewport, used for the ScrollStatus indicator, knowing when to load more and any other consumer of the useProductCardIsVisible hook.
|
|
359
|
+
const targetToIndexMap_ = new Map();
|
|
360
|
+
const indexToTargetMap_ = new Map();
|
|
361
|
+
const [listenersForIntersecting, setListenersForIntersecting] = $3hooq$solidjs.createSignal(0);
|
|
362
|
+
const [currentlyIntersecting, setCurrentlyIntersecting] = $3hooq$solidjs.createSignal(new Set(), {
|
|
363
|
+
equals: false
|
|
364
|
+
});
|
|
365
|
+
const shouldObserve = $3hooq$solidjs.createMemo(() => alwaysObserveCards_ || listenersForIntersecting() > 0);
|
|
366
|
+
const intersection_observer = new IntersectionObserver($3hooq$depictaiutilishared.catchify(records => {
|
|
367
|
+
const intersectingValue = currentlyIntersecting();
|
|
368
|
+
for (let i = 0; i < records.length; i++) {
|
|
369
|
+
const record = records[i];
|
|
370
|
+
const {
|
|
371
|
+
target: target,
|
|
372
|
+
intersectionRatio: intersectionRatio
|
|
373
|
+
} = record;
|
|
374
|
+
const index_of_target = targetToIndexMap_.get(target);
|
|
375
|
+
if (index_of_target == undefined) return; // It seems like it can happen that we get IntersectionObserverEntries after the onCleanup function for a recommendation card has run, in Firefox. Probably a bug in Firefox? If I understood the bug correctly, this is a workaround.
|
|
376
|
+
const is_in_set = intersectingValue.has(index_of_target);
|
|
377
|
+
if (intersectionRatio > 0) {
|
|
378
|
+
if (!is_in_set) intersectingValue.add(index_of_target);
|
|
379
|
+
} else if (is_in_set) intersectingValue.delete(index_of_target);
|
|
380
|
+
}
|
|
381
|
+
setCurrentlyIntersecting(intersectingValue);
|
|
382
|
+
}, "renderDisplays IO failed"));
|
|
383
|
+
const renderedDisplays_ = $3hooq$solidjsweb.createComponent($a52942afacbced93$var$CurrentlyIntersectingContext.Provider, {
|
|
384
|
+
value: {
|
|
385
|
+
currentlyIntersecting_: currentlyIntersecting,
|
|
386
|
+
setIsListening_: setListenersForIntersecting
|
|
387
|
+
},
|
|
388
|
+
get children() {
|
|
389
|
+
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
390
|
+
displays_by_key_: displays_by_key_,
|
|
391
|
+
product_card_template_: product_card_template_,
|
|
392
|
+
content_blocks_: content_blocks_,
|
|
393
|
+
do_per_elements_: (elements, index_accessor) =>
|
|
394
|
+
// Adds/removes elements from the "results in viewport" intersection observer above
|
|
395
|
+
$3hooq$solidjs.createEffect(() => {
|
|
396
|
+
if (!shouldObserve()) return;
|
|
397
|
+
const display_index = index_accessor();
|
|
398
|
+
// Nested createEffect because we only want to re-run this when the index changes (or we should/shouldn't observe)
|
|
399
|
+
// We need to save in a map which index the elements of this template are so that we can know that in the IntersectionObserver callback
|
|
400
|
+
for (let i = 0; i < elements.length; i++) {
|
|
401
|
+
const element = elements[i];
|
|
402
|
+
targetToIndexMap_.set(element, display_index);
|
|
403
|
+
intersection_observer.observe(element);
|
|
404
|
+
$3hooq$solidjs.onCleanup(() => {
|
|
405
|
+
intersection_observer.unobserve(element);
|
|
406
|
+
targetToIndexMap_.delete(element);
|
|
407
|
+
const intersecting = $3hooq$solidjs.untrack(currentlyIntersecting);
|
|
408
|
+
const wasDeleted = intersecting.delete(display_index);
|
|
409
|
+
if (wasDeleted) setCurrentlyIntersecting(intersecting);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
indexToTargetMap_.set(display_index, elements);
|
|
413
|
+
$3hooq$solidjs.onCleanup(() => indexToTargetMap_.delete(display_index));
|
|
414
|
+
})
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
return {
|
|
419
|
+
renderedDisplays_: renderedDisplays_,
|
|
420
|
+
indexToTargetMap_: indexToTargetMap_,
|
|
421
|
+
currentlyIntersecting: currentlyIntersecting
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
function $a52942afacbced93$export$80bb7300ce6a8be3() {
|
|
425
|
+
const {
|
|
426
|
+
setIsListening_: setIsListening_,
|
|
427
|
+
currentlyIntersecting_: currentlyIntersecting_
|
|
428
|
+
} = $3hooq$solidjs.useContext($a52942afacbced93$var$CurrentlyIntersectingContext) || {};
|
|
429
|
+
const getOurIndex = $b54645378dfc7280$export$e3faf4d95300054f();
|
|
430
|
+
const isVisible = $3hooq$solidjs.createMemo(() => currentlyIntersecting_ === null || currentlyIntersecting_ === void 0 ? void 0 : currentlyIntersecting_().has(getOurIndex === null || getOurIndex === void 0 ? void 0 : getOurIndex()));
|
|
431
|
+
setIsListening_ === null || setIsListening_ === void 0 || setIsListening_(prev => prev + 1);
|
|
432
|
+
$3hooq$solidjs.onCleanup(() => setIsListening_ === null || setIsListening_ === void 0 ? void 0 : setIsListening_(prev => prev + 1));
|
|
433
|
+
return isVisible;
|
|
434
|
+
}
|
|
435
|
+
function $d6d51b09cb2116a6$export$5bad61ecde080b1f() {
|
|
436
|
+
const {
|
|
437
|
+
collapse: collapse,
|
|
438
|
+
expand: expand,
|
|
439
|
+
ExpandingContainer: ExpandingContainer
|
|
440
|
+
} = $3hooq$depictaiutilishared.useExpandingContainer(...arguments);
|
|
441
|
+
return {
|
|
442
|
+
collapse: collapse,
|
|
443
|
+
expand: expand,
|
|
444
|
+
ExpandingContainer: _ref => {
|
|
445
|
+
let {
|
|
446
|
+
children: children
|
|
447
|
+
} = _ref;
|
|
448
|
+
// get reactive signals/solid's jsx elements into `ExpandingContainer`
|
|
449
|
+
const fake_div = document.createElement("div");
|
|
450
|
+
const outer_expanding = $3hooq$solidjsweb.createComponent(ExpandingContainer, {
|
|
451
|
+
children: [fake_div]
|
|
452
|
+
});
|
|
453
|
+
const parent = fake_div.parentElement;
|
|
454
|
+
fake_div.remove();
|
|
455
|
+
$3hooq$solidjsweb.insert(parent, children);
|
|
456
|
+
return outer_expanding;
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
const $5401a6698b0c0658$var$transform_elements = sorted_cols_at_size => {
|
|
461
|
+
const cols_at_size = [];
|
|
462
|
+
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
463
|
+
var _sorted_cols_at_size;
|
|
464
|
+
const [nb_cols, width] = sorted_cols_at_size[i];
|
|
465
|
+
const next_width = (_sorted_cols_at_size = sorted_cols_at_size[i + 1]) === null || _sorted_cols_at_size === void 0 ? void 0 : _sorted_cols_at_size[1];
|
|
466
|
+
const max_width = i === 0 ? "" : "".concat(width, "px");
|
|
467
|
+
const min_width = next_width !== undefined ? "".concat(next_width + 1, "px") : "";
|
|
468
|
+
const col_at_size = [nb_cols, min_width, max_width];
|
|
469
|
+
cols_at_size.push(col_at_size);
|
|
470
|
+
}
|
|
471
|
+
return cols_at_size;
|
|
472
|
+
};
|
|
473
|
+
const $5401a6698b0c0658$export$6daf8749b65a1b77 = cols_at_size => {
|
|
474
|
+
var _cols_at_size$every;
|
|
475
|
+
// Check that every element is an array
|
|
476
|
+
const are_arrays = cols_at_size === null || cols_at_size === void 0 ? void 0 : (_cols_at_size$every = cols_at_size.every) === null || _cols_at_size$every === void 0 ? void 0 : _cols_at_size$every.call(cols_at_size, element => Array.isArray(element));
|
|
477
|
+
if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
|
|
478
|
+
// Check width duplicates
|
|
479
|
+
const widths = cols_at_size.map(_ref => {
|
|
480
|
+
let [_, width] = _ref;
|
|
481
|
+
return width;
|
|
482
|
+
});
|
|
483
|
+
const widths_set = new Set(widths);
|
|
484
|
+
if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
|
|
485
|
+
if (cols_at_size.length === 1) {
|
|
486
|
+
const [nb_cols, width] = cols_at_size[0];
|
|
487
|
+
const max_width = width !== undefined ? "".concat(width, "px") : "";
|
|
488
|
+
return [[nb_cols, "", max_width]];
|
|
489
|
+
}
|
|
490
|
+
// Sort widths in ascending order
|
|
491
|
+
const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
|
|
492
|
+
const [_b, width_A] = a;
|
|
493
|
+
const [_a, width_b] = b;
|
|
494
|
+
if (width_A === undefined) return -1;
|
|
495
|
+
if (width_b === undefined) return 1;
|
|
496
|
+
return width_b - width_A;
|
|
497
|
+
});
|
|
498
|
+
return $5401a6698b0c0658$var$transform_elements(sorted_cols_at_size);
|
|
499
|
+
};
|
|
500
|
+
function $8edd3cf30d1fd8b4$export$a2cc176055f8f08() {
|
|
501
|
+
let what = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "grid";
|
|
502
|
+
const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the " + what + " before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
|
|
503
|
+
return (0, $3hooq$solidjsweb.isServer) ? {
|
|
504
|
+
t: "<!-- ".concat(text, " -->")
|
|
505
|
+
} : document.createComment(text);
|
|
506
|
+
}
|
|
507
|
+
let $e3915574cfd3466c$var$cached_placeholder_element;
|
|
508
|
+
let $e3915574cfd3466c$var$rendering_cached_placeholder_element;
|
|
509
|
+
function $e3915574cfd3466c$export$f33414a4df0afd3f(_ref) {
|
|
510
|
+
let {
|
|
511
|
+
product_card_template_: product_card_template_,
|
|
512
|
+
num_placeholders_: num_placeholders_,
|
|
513
|
+
content_blocks_: content_blocks_
|
|
514
|
+
} = _ref;
|
|
515
|
+
const [num_to_actually_show, set_num_to_actually_show] = $3hooq$solidjs.createSignal($3hooq$solidjs.untrack(num_placeholders_));
|
|
516
|
+
if (0, $3hooq$solidjsweb.isServer)
|
|
517
|
+
// want to render simple placeholders on server, effects don't run there
|
|
518
|
+
// FIXME when adding proper SSR: also SSR content blocks
|
|
519
|
+
return $3hooq$solidjs.createMemo(() => Array.from({
|
|
520
|
+
length: num_placeholders_()
|
|
521
|
+
}).map(() => {
|
|
522
|
+
const template_result = product_card_template_(null, undefined);
|
|
523
|
+
// @ts-ignore
|
|
524
|
+
if (typeof (template_result === null || template_result === void 0 ? void 0 : template_result.then) !== "function") return template_result;
|
|
525
|
+
}));
|
|
526
|
+
$3hooq$solidjs.createRenderEffect(() => {
|
|
527
|
+
const existing_num = num_to_actually_show();
|
|
528
|
+
const to_add = num_placeholders_() - existing_num;
|
|
529
|
+
if (to_add <= 0) return;
|
|
530
|
+
// Below comment is from when we used recommendation renderer and manual DOM manipulation for this, but I'm still scared to remove placeholders and mess up scroll restoration, so I'm keeping the way it worked. Otherwise, <Index> could be used which would be far more elegant.
|
|
531
|
+
// We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
|
|
532
|
+
// The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
|
|
533
|
+
// Above comments were from when we added elements in this createRenderEffect. Now I changed it to just increment the number and render them from an <Index> instead, so I can add content blocks better
|
|
534
|
+
// Functionality should be the same
|
|
535
|
+
set_num_to_actually_show(existing_num + to_add);
|
|
536
|
+
});
|
|
537
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Index), {
|
|
538
|
+
get each() {
|
|
539
|
+
return Array.from({
|
|
540
|
+
length: num_to_actually_show()
|
|
541
|
+
});
|
|
542
|
+
},
|
|
543
|
+
children: (_item, index) => {
|
|
544
|
+
const possible_content_block = $3hooq$solidjs.createMemo(() => {
|
|
545
|
+
var _content_blocks_, _content_blocks_2;
|
|
546
|
+
return content_blocks_ === null || content_blocks_ === void 0 ? void 0 : (_content_blocks_ = content_blocks_()) === null || _content_blocks_ === void 0 ? void 0 : (_content_blocks_2 = _content_blocks_()) === null || _content_blocks_2 === void 0 ? void 0 : _content_blocks_2[index];
|
|
547
|
+
});
|
|
548
|
+
// Show content block before product card, so it's *at* that index
|
|
549
|
+
return [possible_content_block, $e3915574cfd3466c$var$Placeholder({
|
|
550
|
+
product_card_template_: product_card_template_
|
|
551
|
+
})]; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
557
|
+
*/
|
|
558
|
+
function $e3915574cfd3466c$var$Placeholder(_ref2) {
|
|
559
|
+
let {
|
|
560
|
+
product_card_template_: product_card_template_
|
|
561
|
+
} = _ref2;
|
|
562
|
+
const get_cloned_placeholders = function () {
|
|
563
|
+
let element_to_clone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $e3915574cfd3466c$var$cached_placeholder_element;
|
|
564
|
+
return Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
|
|
565
|
+
};
|
|
566
|
+
if ($e3915574cfd3466c$var$cached_placeholder_element) return get_cloned_placeholders();
|
|
567
|
+
let dispose_original_copy;
|
|
568
|
+
const get_unwrapped_element = $3hooq$solidjs.createRoot(dispose => {
|
|
569
|
+
dispose_original_copy = dispose;
|
|
570
|
+
// if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
|
|
571
|
+
const [resource] = $3hooq$solidjs.createResource(() => {
|
|
572
|
+
if ($e3915574cfd3466c$var$rendering_cached_placeholder_element) return $e3915574cfd3466c$var$rendering_cached_placeholder_element;
|
|
573
|
+
const return_value = product_card_template_(null, undefined);
|
|
574
|
+
if (typeof return_value === "object" && typeof (return_value === null || return_value === void 0 ? void 0 : return_value.then) === "function")
|
|
575
|
+
// Is Promise or promise-like object
|
|
576
|
+
$e3915574cfd3466c$var$rendering_cached_placeholder_element = return_value;
|
|
577
|
+
return return_value;
|
|
578
|
+
});
|
|
579
|
+
return $3hooq$solidjs.createMemo(() => {
|
|
580
|
+
if (resource.loading) return () => [];
|
|
581
|
+
return $e82d0d417fa613e8$export$2f0cbfbb4354bb52(resource);
|
|
582
|
+
});
|
|
583
|
+
});
|
|
584
|
+
$3hooq$solidjs.onCleanup(() => {
|
|
585
|
+
if ($e3915574cfd3466c$var$rendering_cached_placeholder_element) {
|
|
586
|
+
var _rendering_cached_pla;
|
|
587
|
+
// If we're still rendering in our separate root, let the rendering finish or other <Placeholder> components waiting for it might get an incomplete result
|
|
588
|
+
const unset_current_rendering = () => {
|
|
589
|
+
dispose_original_copy();
|
|
590
|
+
$e3915574cfd3466c$var$rendering_cached_placeholder_element = undefined;
|
|
591
|
+
};
|
|
592
|
+
(_rendering_cached_pla = $e3915574cfd3466c$var$rendering_cached_placeholder_element) === null || _rendering_cached_pla === void 0 || _rendering_cached_pla.then(unset_current_rendering, unset_current_rendering);
|
|
593
|
+
} else
|
|
594
|
+
// Otherwise, just make sure we've disposed our root
|
|
595
|
+
dispose_original_copy();
|
|
596
|
+
});
|
|
597
|
+
return $3hooq$solidjs.createMemo(() => {
|
|
598
|
+
const unwrapped_array = get_unwrapped_element()();
|
|
599
|
+
if (!(unwrapped_array !== null && unwrapped_array !== void 0 && unwrapped_array.length) || !unwrapped_array.every(item => item))
|
|
600
|
+
// Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
|
|
601
|
+
return;
|
|
602
|
+
// placeholders have finished rendering, freeze the elements
|
|
603
|
+
// here we might receive the result of a promise that has already been received, tore down and put into cached_placeholder_element, so don't overwrite that more valid result if it's already set
|
|
604
|
+
$e3915574cfd3466c$var$cached_placeholder_element || ($e3915574cfd3466c$var$cached_placeholder_element = get_cloned_placeholders(unwrapped_array)); // Clone initial return value so that who gave us the elements can't mutate them, which has caused issues before with react
|
|
605
|
+
$e3915574cfd3466c$var$rendering_cached_placeholder_element = undefined;
|
|
606
|
+
dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
|
|
607
|
+
return get_cloned_placeholders(); // clone, just in case. If we wouldn't, someone could modify the copy in the DOM, and it would affect the cached version
|
|
608
|
+
});
|
|
609
|
+
}
|
|
524
610
|
|
|
525
611
|
// Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
|
|
526
612
|
class $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 extends Error {}
|
|
@@ -807,10 +893,13 @@ function $236a257ee52e5414$export$d41d19e89346fa2(_ref) {
|
|
|
807
893
|
return (() => {
|
|
808
894
|
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
809
895
|
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
810
|
-
|
|
896
|
+
const {
|
|
897
|
+
renderedDisplays_: renderedDisplays_
|
|
898
|
+
} = $a52942afacbced93$export$4a14175d33d81a96({
|
|
811
899
|
displays_by_key_: displays_by_key_,
|
|
812
900
|
product_card_template_: product_card_template_
|
|
813
901
|
});
|
|
902
|
+
return renderedDisplays_;
|
|
814
903
|
})();
|
|
815
904
|
}
|
|
816
905
|
});
|
|
@@ -1853,10 +1942,13 @@ function $2c920813c92d6987$export$7da560f849543dff(_ref) {
|
|
|
1853
1942
|
return (() => {
|
|
1854
1943
|
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
1855
1944
|
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
1856
|
-
|
|
1945
|
+
const {
|
|
1946
|
+
renderedDisplays_: renderedDisplays_
|
|
1947
|
+
} = $a52942afacbced93$export$4a14175d33d81a96({
|
|
1857
1948
|
displays_by_key_: displays_by_key_,
|
|
1858
1949
|
product_card_template_: product_card_template_
|
|
1859
1950
|
});
|
|
1951
|
+
return renderedDisplays_;
|
|
1860
1952
|
})();
|
|
1861
1953
|
}
|
|
1862
1954
|
});
|
|
@@ -6635,7 +6727,7 @@ function $9c1d49181fb3002a$var$expand_until_choice(data_structure) {
|
|
|
6635
6727
|
}
|
|
6636
6728
|
});
|
|
6637
6729
|
}
|
|
6638
|
-
var $cd0e5524f9476f9b$var$_tmpl$ = ["<div", ' class="checkbox-grid" style="position:absolute;z-index:-1;pointer-events:none;opacity:0">', "</div>"],
|
|
6730
|
+
var $cd0e5524f9476f9b$var$_tmpl$ = ["<div", ' class="checkbox-grid" style="position:absolute;z-index:-1;pointer-events:none;opacity:0" aria-hidden="true">', "</div>"],
|
|
6639
6731
|
$cd0e5524f9476f9b$var$_tmpl$2 = ["<span", ' class="count-wrapper"><span class="count">', "</span></span>"];
|
|
6640
6732
|
const $cd0e5524f9476f9b$var$gap_px = 5;
|
|
6641
6733
|
const $cd0e5524f9476f9b$var$max_columns = 3;
|
|
@@ -6749,7 +6841,9 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
|
|
|
6749
6841
|
}
|
|
6750
6842
|
})), "<!--/-->"], true);
|
|
6751
6843
|
};
|
|
6752
|
-
const invisible_size_button = $3hooq$solidjsweb.createComponent(MakeButton, {
|
|
6844
|
+
const invisible_size_button = $3hooq$solidjsweb.createComponent(MakeButton, {
|
|
6845
|
+
tabIndex: -1
|
|
6846
|
+
});
|
|
6753
6847
|
const smallest_possible_size = $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
|
|
6754
6848
|
const sizes_value = $3hooq$solidjs.untrack(sizes_set);
|
|
6755
6849
|
const shadow_children_value = $3hooq$solidjs.untrack(shadow_children);
|
|
@@ -8712,10 +8806,13 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
8712
8806
|
if (!should_show() && prev) return prev; // When we're invisible, don't update what we're rendering to be possibly undefined to preserve the same products if possible
|
|
8713
8807
|
return recommendations_resource() || [];
|
|
8714
8808
|
}));
|
|
8715
|
-
|
|
8809
|
+
const {
|
|
8810
|
+
renderedDisplays_: renderedDisplays_
|
|
8811
|
+
} = $a52942afacbced93$export$4a14175d33d81a96({
|
|
8716
8812
|
displays_by_key_: displays_by_key_,
|
|
8717
8813
|
product_card_template_: product_card_template_
|
|
8718
8814
|
});
|
|
8815
|
+
return renderedDisplays_;
|
|
8719
8816
|
})();
|
|
8720
8817
|
}
|
|
8721
8818
|
});
|
|
@@ -9484,8 +9581,8 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
9484
9581
|
let {
|
|
9485
9582
|
plp_results_: plp_results_,
|
|
9486
9583
|
product_card_template_: product_card_template_,
|
|
9487
|
-
first_result_in_viewport_: [,
|
|
9488
|
-
last_result_in_viewport_: [
|
|
9584
|
+
first_result_in_viewport_: [, setFirstResultInViewport],
|
|
9585
|
+
last_result_in_viewport_: [lastResultInViewport, setLastResultsInViewport],
|
|
9489
9586
|
all_products_loaded_: all_products_loaded_,
|
|
9490
9587
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
9491
9588
|
query_base_: query_base_,
|
|
@@ -9493,27 +9590,6 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
9493
9590
|
is_loading_: is_loading_,
|
|
9494
9591
|
content_blocks_: content_blocks_
|
|
9495
9592
|
} = _ref;
|
|
9496
|
-
// The following sets up an intersection observer to determine which results are in the viewport, used for the ScrollStatus indicator and knowing when to load more
|
|
9497
|
-
const target_to_index_map = new Map();
|
|
9498
|
-
const index_to_target_map_ = new Map();
|
|
9499
|
-
const currently_intersecting = new Set();
|
|
9500
|
-
const intersection_observer = new IntersectionObserver($3hooq$depictaiutilishared.catchify(records => {
|
|
9501
|
-
for (let i = 0; i < records.length; i++) {
|
|
9502
|
-
const record = records[i];
|
|
9503
|
-
const {
|
|
9504
|
-
target: target,
|
|
9505
|
-
intersectionRatio: intersectionRatio
|
|
9506
|
-
} = record;
|
|
9507
|
-
const index_of_target = target_to_index_map.get(target);
|
|
9508
|
-
if (index_of_target == undefined) return; // It seems like it can happen that we get IntersectionObserverEntries after the onCleanup function for a recommendation card has run, in Firefox. Probably a bug in Firefox? If I understood the bug correctly, this is a workaround.
|
|
9509
|
-
const is_in_set = currently_intersecting.has(index_of_target);
|
|
9510
|
-
if (intersectionRatio > 0) {
|
|
9511
|
-
if (!is_in_set) currently_intersecting.add(index_of_target);
|
|
9512
|
-
} else if (is_in_set) currently_intersecting.delete(index_of_target);
|
|
9513
|
-
}
|
|
9514
|
-
set_first_result_in_viewport(Math.min(...currently_intersecting) + 1); // +1 because we want to start counting at 1
|
|
9515
|
-
set_last_result_in_viewport(Math.max(...currently_intersecting) + 1);
|
|
9516
|
-
}, "PLPResults IO failed"));
|
|
9517
9593
|
// Although typing doesn't reflect it, plp_results is guaranteed to contain an array of at least one display at this point
|
|
9518
9594
|
const [get_extra_displays, set_extra_displays_] = $3hooq$solidjs.createSignal([], {
|
|
9519
9595
|
equals: false
|
|
@@ -9522,10 +9598,20 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
9522
9598
|
var _plp_results_;
|
|
9523
9599
|
return [...(((_plp_results_ = plp_results_()) === null || _plp_results_ === void 0 ? void 0 : _plp_results_.displays) || []), ...get_extra_displays()];
|
|
9524
9600
|
}));
|
|
9601
|
+
const {
|
|
9602
|
+
indexToTargetMap_: indexToTargetMap_,
|
|
9603
|
+
renderedDisplays_: renderedDisplays_,
|
|
9604
|
+
currentlyIntersecting: currentlyIntersecting
|
|
9605
|
+
} = $a52942afacbced93$export$4a14175d33d81a96({
|
|
9606
|
+
displays_by_key_: displays_by_key_,
|
|
9607
|
+
product_card_template_: product_card_template_,
|
|
9608
|
+
content_blocks_: content_blocks_,
|
|
9609
|
+
alwaysObserveCards_: true
|
|
9610
|
+
});
|
|
9525
9611
|
const percentage_in_view_ = $45c16e404a883f74$export$63dd0350f8559dda({
|
|
9526
|
-
get_last_result_in_viewport_:
|
|
9612
|
+
get_last_result_in_viewport_: lastResultInViewport,
|
|
9527
9613
|
displays_by_key_: displays_by_key_,
|
|
9528
|
-
index_to_target_map_:
|
|
9614
|
+
index_to_target_map_: indexToTargetMap_,
|
|
9529
9615
|
is_loading_: is_loading_,
|
|
9530
9616
|
get_extra_displays: get_extra_displays
|
|
9531
9617
|
});
|
|
@@ -9538,30 +9624,12 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
9538
9624
|
query_base_: query_base_,
|
|
9539
9625
|
depict_api_: depict_api_
|
|
9540
9626
|
});
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
do_per_elements_: (elements, index_accessor) =>
|
|
9546
|
-
// Adds/removes elements from the "results in viewport" intersection observer above
|
|
9547
|
-
$3hooq$solidjs.createEffect(() => {
|
|
9548
|
-
const display_index = index_accessor();
|
|
9549
|
-
// Nested createEffect because we only want to re-run this when the index changes
|
|
9550
|
-
// We need to save in a map which index the elements of this template are so that we can know that in the IntersectionObserver callback
|
|
9551
|
-
for (let i = 0; i < elements.length; i++) {
|
|
9552
|
-
const element = elements[i];
|
|
9553
|
-
target_to_index_map.set(element, display_index);
|
|
9554
|
-
intersection_observer.observe(element);
|
|
9555
|
-
$3hooq$solidjs.onCleanup(() => {
|
|
9556
|
-
intersection_observer.unobserve(element);
|
|
9557
|
-
target_to_index_map.delete(element);
|
|
9558
|
-
currently_intersecting.delete(display_index);
|
|
9559
|
-
});
|
|
9560
|
-
}
|
|
9561
|
-
index_to_target_map_.set(display_index, elements);
|
|
9562
|
-
$3hooq$solidjs.onCleanup(() => index_to_target_map_.delete(display_index));
|
|
9563
|
-
})
|
|
9627
|
+
$3hooq$solidjs.createEffect(() => {
|
|
9628
|
+
const intersecting = currentlyIntersecting();
|
|
9629
|
+
setFirstResultInViewport(Math.min(...intersecting) + 1); // +1 because we want to start counting at 1
|
|
9630
|
+
setLastResultsInViewport(Math.max(...intersecting) + 1);
|
|
9564
9631
|
});
|
|
9632
|
+
return renderedDisplays_;
|
|
9565
9633
|
}
|
|
9566
9634
|
var $830518481649feb1$var$_tmpl$ = ["<style", ' type="text/css">', "</style>"];
|
|
9567
9635
|
const $830518481649feb1$export$c500183c31c2b22e = "--spans-columns";
|
|
@@ -9958,11 +10026,13 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
9958
10026
|
cols_at_size_: modified_cols_at_size,
|
|
9959
10027
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
9960
10028
|
}));
|
|
9961
|
-
const rendered_placeholders = $3hooq$solidjs.createMemo(() =>
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
10029
|
+
const rendered_placeholders = $3hooq$solidjs.createMemo(() => {
|
|
10030
|
+
if (get_should_have_placeholders_rendered()) return $3hooq$solidjs.children(() => $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
10031
|
+
content_blocks_: content_blocks_,
|
|
10032
|
+
product_card_template_: product_card_template_,
|
|
10033
|
+
num_placeholders_: num_placeholders_
|
|
10034
|
+
}));
|
|
10035
|
+
});
|
|
9966
10036
|
const layout = $3hooq$solidjs.createMemo(() => {
|
|
9967
10037
|
const incoming_layout = layout_options_().layout;
|
|
9968
10038
|
if (incoming_layout === "slider-without-filters") return "slider";
|
|
@@ -9997,7 +10067,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
9997
10067
|
(For the whole idea of the displays being cached to work we can't tear down and re-run ProductCards for every new result.
|
|
9998
10068
|
We have to keep ProductCards alive, but hidden, and feed them new data as soon as we had it)
|
|
9999
10069
|
*/
|
|
10000
|
-
const product_cards_when_data = $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
|
|
10070
|
+
const product_cards_when_data = $3hooq$solidjs.children(() => $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
|
|
10001
10071
|
get fallback() {
|
|
10002
10072
|
fallback_is_alive = true;
|
|
10003
10073
|
$3hooq$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
@@ -10029,17 +10099,20 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
10029
10099
|
return suspense_contents;
|
|
10030
10100
|
})();
|
|
10031
10101
|
}
|
|
10032
|
-
});
|
|
10102
|
+
}));
|
|
10033
10103
|
/* This Show is so that we show placeholders while query_base is loading and because it's cumbersome to ensure that everything that directly accesses the plp_results_ resource is within the <Suspense> boundary */
|
|
10034
|
-
const listing_contents = $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
10104
|
+
const listing_contents = $3hooq$solidjs.children(() => $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
10035
10105
|
get when() {
|
|
10036
10106
|
return !is_loading_();
|
|
10037
10107
|
},
|
|
10038
10108
|
get fallback() {
|
|
10039
|
-
|
|
10109
|
+
var _rendered_placeholder;
|
|
10110
|
+
return (_rendered_placeholder = rendered_placeholders()) === null || _rendered_placeholder === void 0 ? void 0 : _rendered_placeholder();
|
|
10040
10111
|
},
|
|
10041
|
-
children
|
|
10042
|
-
|
|
10112
|
+
get children() {
|
|
10113
|
+
return product_cards_when_data();
|
|
10114
|
+
}
|
|
10115
|
+
}));
|
|
10043
10116
|
return [$8edd3cf30d1fd8b4$export$a2cc176055f8f08(layout()), $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
10044
10117
|
get when() {
|
|
10045
10118
|
return doesnt_have_content_blocks();
|
|
@@ -10059,7 +10132,9 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
10059
10132
|
class: "cards css-grid"
|
|
10060
10133
|
},
|
|
10061
10134
|
top_row_shortened_by_: top_row_shortened_by_,
|
|
10062
|
-
children
|
|
10135
|
+
get children() {
|
|
10136
|
+
return listing_contents();
|
|
10137
|
+
}
|
|
10063
10138
|
});
|
|
10064
10139
|
},
|
|
10065
10140
|
get children() {
|
|
@@ -10112,7 +10187,9 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
10112
10187
|
$3hooq$solidjsweb.insert(container, $3hooq$solidjs.createMemo(() => [...non_solid_nodes, rendered_scroll_status]));
|
|
10113
10188
|
}
|
|
10114
10189
|
},
|
|
10115
|
-
children
|
|
10190
|
+
get children() {
|
|
10191
|
+
return listing_contents();
|
|
10192
|
+
}
|
|
10116
10193
|
});
|
|
10117
10194
|
},
|
|
10118
10195
|
get children() {
|
|
@@ -10133,7 +10210,9 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
10133
10210
|
element_attributes: {
|
|
10134
10211
|
class: "cards"
|
|
10135
10212
|
},
|
|
10136
|
-
children
|
|
10213
|
+
get children() {
|
|
10214
|
+
return listing_contents();
|
|
10215
|
+
}
|
|
10137
10216
|
});
|
|
10138
10217
|
}
|
|
10139
10218
|
});
|