@depict-ai/ui 1.4.25 → 2.0.0
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 +231 -170
- package/ES10/index.d.ts +27 -31
- package/ES10/index.js +233 -172
- package/README.md +2 -1
- package/latest/index.cjs +220 -166
- package/latest/index.d.ts +27 -31
- package/latest/index.js +222 -168
- package/locales/require.js +1152 -0
- package/package.json +7 -7
- package/server/ES10/index.cjs +190 -139
- package/server/ES10/index.d.ts +27 -31
- package/server/ES10/index.js +192 -141
- package/server/latest/index.cjs +180 -131
- package/server/latest/index.d.ts +27 -31
- package/server/latest/index.js +182 -133
package/README.md
CHANGED
|
@@ -7,4 +7,5 @@ Breaking changes:
|
|
|
7
7
|
- 1.1.0 made the `include_input_field` option of `SearchPage` default to true
|
|
8
8
|
- 1.2.0 added `page_url_creator` and changed typing to support it. The only breaking change is that this potentially causes type errors where the resolution is to move the generics to the provider instead of the SearchPage and CategoryPage components.
|
|
9
9
|
- 1.3.0 moved `depict-filter-sort-mobile-modal-container` from being a class to being an id
|
|
10
|
-
- 1.4.0 Added `brand_` translation string to Locale.
|
|
10
|
+
- 1.4.0 Added `brand_` translation string to Locale.
|
|
11
|
+
- 2.0.0 Made `enable_content_search` `true` by default. Redesigned filter counts.
|
package/latest/index.cjs
CHANGED
|
@@ -60,7 +60,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
60
60
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
61
61
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
62
62
|
/*! Depict.ai search and product listing SDK */
|
|
63
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "
|
|
63
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.0";
|
|
64
64
|
const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
|
|
65
65
|
const cols_at_size = [];
|
|
66
66
|
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
@@ -119,7 +119,9 @@ function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_f
|
|
|
119
119
|
}
|
|
120
120
|
function $fc23d7668ae0011d$export$a2cc176055f8f08() {
|
|
121
121
|
const text = "Please try setting `colsAtSize` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
|
|
122
|
-
return (0, $gVhhF$solidjsweb.isServer) ?
|
|
122
|
+
return (0, $gVhhF$solidjsweb.isServer) ? {
|
|
123
|
+
t: `<!-- ${text} -->`
|
|
124
|
+
} : document.createComment(text);
|
|
123
125
|
}
|
|
124
126
|
function $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(elements) {
|
|
125
127
|
// FYI this probably doesn't work on hugely deep nestings or large amount of elements
|
|
@@ -334,9 +336,14 @@ function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
|
|
|
334
336
|
const $f48d0fbb00835aaa$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div></div>`, 2),
|
|
335
337
|
$f48d0fbb00835aaa$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<style type="text/css"></style>`, 2);
|
|
336
338
|
function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
|
|
339
|
+
const container_class = "x" + $gVhhF$solidjs.createUniqueId();
|
|
337
340
|
const container_element_ = (() => {
|
|
338
341
|
const _el$ = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
|
|
339
|
-
$gVhhF$solidjsweb.spread(_el$, $gVhhF$solidjsweb.mergeProps(() => props.element_attributes
|
|
342
|
+
$gVhhF$solidjsweb.spread(_el$, $gVhhF$solidjsweb.mergeProps(() => props.element_attributes, {
|
|
343
|
+
"classList": {
|
|
344
|
+
[container_class]: true
|
|
345
|
+
}
|
|
346
|
+
}), false, true);
|
|
340
347
|
$gVhhF$solidjsweb.insert(_el$, () => props.children);
|
|
341
348
|
$gVhhF$solidjsweb.runHydrationEvents();
|
|
342
349
|
return _el$;
|
|
@@ -347,11 +354,16 @@ function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
|
|
|
347
354
|
},
|
|
348
355
|
severity_: "error",
|
|
349
356
|
get children() {
|
|
350
|
-
return $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element_);
|
|
357
|
+
return $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element_, false, container_class);
|
|
351
358
|
}
|
|
352
359
|
});
|
|
353
360
|
}
|
|
354
|
-
function $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element, insert_after_container = false) {
|
|
361
|
+
function $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element, insert_after_container = false, container_class) {
|
|
362
|
+
if (!container_class) {
|
|
363
|
+
// only try to add if it wasn't provided, so that we have a code path without classList when doing SSR
|
|
364
|
+
container_class = $gVhhF$depictaiutilishared.make_random_classname();
|
|
365
|
+
container_element.classList.add(container_class);
|
|
366
|
+
}
|
|
355
367
|
// Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
|
|
356
368
|
const show_all_rows = $gVhhF$solidjs.createMemo(() => props.rows === "all");
|
|
357
369
|
const rows_or_empty_object = $gVhhF$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
|
|
@@ -366,46 +378,41 @@ function $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element, ins
|
|
|
366
378
|
return !(!button || Array.isArray(button) && !button.length);
|
|
367
379
|
});
|
|
368
380
|
const [get_styling, set_styling] = $gVhhF$solidjs.createSignal();
|
|
369
|
-
const container_class = $gVhhF$depictaiutilishared.make_random_classname();
|
|
370
381
|
const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
|
|
371
382
|
const [get_children_count, set_children_count] = $gVhhF$solidjs.createSignal(0);
|
|
372
|
-
const update_children_count = () => set_children_count(container_element.children.length);
|
|
383
|
+
const update_children_count = () => (0, $gVhhF$solidjsweb.isServer) ? 20 : set_children_count(container_element.children.length);
|
|
373
384
|
const col_styling = $gVhhF$solidjs.createMemo(() => $gVhhF$depictaiutilishared.n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
|
|
374
385
|
const default_currently_visible_signal = $gVhhF$solidjs.createSignal($gVhhF$solidjs.untrack(() => rows_or_empty_object().start_rows ?? 1)); // Keep this signal here, so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
|
|
375
386
|
const rows_visible_signal = $gVhhF$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
|
|
376
387
|
const get_rows_visible = $gVhhF$solidjs.createMemo(() => rows_visible_signal()[0]());
|
|
377
388
|
const set_rows_visible = $gVhhF$solidjs.createMemo(() => rows_visible_signal()[1]);
|
|
378
|
-
const view_more_button_class = $gVhhF$
|
|
379
|
-
const view_less_button_class = $gVhhF$
|
|
380
|
-
const style_element = (() => {
|
|
381
|
-
const _el$2 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$2);
|
|
382
|
-
$gVhhF$solidjsweb.insert(_el$2, get_styling);
|
|
383
|
-
return _el$2;
|
|
384
|
-
})();
|
|
389
|
+
const view_more_button_class = "m" + $gVhhF$solidjs.createUniqueId();
|
|
390
|
+
const view_less_button_class = "l" + $gVhhF$solidjs.createUniqueId(); // https://github.com/solidjs/solid-docs/issues/263#issuecomment-1622388079
|
|
385
391
|
const view_more_button_container = $gVhhF$solidjs.createMemo(() => have_a_view_more_button() && (() => {
|
|
386
|
-
const _el$
|
|
387
|
-
$gVhhF$solidjsweb.addEventListener(_el$
|
|
388
|
-
$gVhhF$solidjsweb.className(_el$
|
|
389
|
-
$gVhhF$solidjsweb.insert(_el$
|
|
392
|
+
const _el$2 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
|
|
393
|
+
$gVhhF$solidjsweb.addEventListener(_el$2, "click", $gVhhF$depictaiutilishared.catchify(() => set_rows_visible()(prev => prev + (rows_or_empty_object().rows_per_click ?? 1))), true);
|
|
394
|
+
$gVhhF$solidjsweb.className(_el$2, `load-more-container ${view_more_button_class}`);
|
|
395
|
+
$gVhhF$solidjsweb.insert(_el$2, () => rows_or_empty_object().button);
|
|
390
396
|
$gVhhF$solidjsweb.runHydrationEvents();
|
|
391
|
-
return _el$
|
|
397
|
+
return _el$2;
|
|
392
398
|
})());
|
|
393
399
|
// We need to have duplicate buttons because which ones is shown depends on the number of rows visible and therefore on the viewport size and therefore on the css media queries
|
|
394
400
|
const view_less_button_container = $gVhhF$solidjs.createMemo(() => have_a_view_less_button() && (() => {
|
|
395
|
-
const _el$
|
|
396
|
-
$gVhhF$solidjsweb.addEventListener(_el$
|
|
397
|
-
$gVhhF$solidjsweb.className(_el$
|
|
398
|
-
$gVhhF$solidjsweb.insert(_el$
|
|
401
|
+
const _el$3 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$);
|
|
402
|
+
$gVhhF$solidjsweb.addEventListener(_el$3, "click", $gVhhF$depictaiutilishared.catchify(() => set_rows_visible()(() => rows_or_empty_object().start_rows ?? 1)), true);
|
|
403
|
+
$gVhhF$solidjsweb.className(_el$3, `load-less-container ${view_less_button_class}`);
|
|
404
|
+
$gVhhF$solidjsweb.insert(_el$3, () => rows_or_empty_object().view_less_button);
|
|
399
405
|
$gVhhF$solidjsweb.runHydrationEvents();
|
|
400
|
-
return _el$
|
|
406
|
+
return _el$3;
|
|
401
407
|
})());
|
|
402
|
-
|
|
408
|
+
const [force_style_update, set_force_style_update] = $gVhhF$solidjs.createSignal("");
|
|
403
409
|
$gVhhF$solidjs.createComputed(() => {
|
|
404
410
|
// Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
|
|
405
411
|
const rows_visible = get_rows_visible();
|
|
406
412
|
const max_rows = rows_or_empty_object().max_rows;
|
|
407
413
|
if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
|
|
408
414
|
});
|
|
415
|
+
$gVhhF$solidjs.createEffect(() => set_force_style_update(" ")); // force style update after hydration due to https://discord.com/channels/722131463138705510/722167424186843267/1151544212517552168
|
|
409
416
|
$gVhhF$solidjs.createRenderEffect(() => {
|
|
410
417
|
// Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
|
|
411
418
|
if (show_all_rows()) {
|
|
@@ -414,11 +421,13 @@ function $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element, ins
|
|
|
414
421
|
return;
|
|
415
422
|
}
|
|
416
423
|
update_children_count();
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
424
|
+
if (!(0, $gVhhF$solidjsweb.isServer)) {
|
|
425
|
+
const mutation_observer = new MutationObserver($gVhhF$depictaiutilishared.catchify(update_children_count));
|
|
426
|
+
mutation_observer.observe(container_element, {
|
|
427
|
+
childList: true
|
|
428
|
+
});
|
|
429
|
+
$gVhhF$solidjs.onCleanup(() => mutation_observer.disconnect());
|
|
430
|
+
}
|
|
422
431
|
set_styling(
|
|
423
432
|
// this is needed because solid will think that the memo-accessor is a setter function otherwise
|
|
424
433
|
() => $gVhhF$solidjs.createMemo(() => {
|
|
@@ -429,7 +438,7 @@ function $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element, ins
|
|
|
429
438
|
} = rows_or_empty_object();
|
|
430
439
|
const rows_visible = get_rows_visible();
|
|
431
440
|
const children_count = get_children_count();
|
|
432
|
-
return col_styling() + props.cols_at_size.map(options => {
|
|
441
|
+
return force_style_update() + col_styling() + props.cols_at_size.map(options => {
|
|
433
442
|
const [recs_per_row, min, max] = options;
|
|
434
443
|
let should_hide_view_more_button;
|
|
435
444
|
let visible_recs;
|
|
@@ -450,6 +459,11 @@ function $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element, ins
|
|
|
450
459
|
}).join("");
|
|
451
460
|
}));
|
|
452
461
|
});
|
|
462
|
+
const style_element = (() => {
|
|
463
|
+
const _el$4 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$2);
|
|
464
|
+
$gVhhF$solidjsweb.insert(_el$4, get_styling);
|
|
465
|
+
return _el$4;
|
|
466
|
+
})(); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
|
|
453
467
|
if (insert_after_container) container_element.after(style_element);
|
|
454
468
|
return [container_element, $gVhhF$solidjsweb.memo(view_more_button_container), $gVhhF$solidjsweb.memo(view_less_button_container), style_element];
|
|
455
469
|
}
|
|
@@ -477,18 +491,26 @@ function $a0e53f99354809d9$export$6649caad96ef8870({
|
|
|
477
491
|
slider_ref_: slider_ref_,
|
|
478
492
|
faded_opacity_ = 0.7,
|
|
479
493
|
mutation_plugins_ = [],
|
|
480
|
-
disable_fading_: disable_fading_
|
|
494
|
+
disable_fading_: disable_fading_,
|
|
495
|
+
arrow_width_: arrow_width_,
|
|
496
|
+
arrow_height_: arrow_height_
|
|
481
497
|
}) {
|
|
482
498
|
const slider = new (0, $gVhhF$depictaiutilishared.Amazing_Slider)({
|
|
483
499
|
button_contents: {
|
|
484
500
|
left: [(() => {
|
|
485
501
|
const _el$ = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
|
|
486
|
-
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {
|
|
502
|
+
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {
|
|
503
|
+
height_: arrow_height_,
|
|
504
|
+
width_: arrow_width_
|
|
505
|
+
}));
|
|
487
506
|
return _el$;
|
|
488
507
|
})()],
|
|
489
508
|
right: [(() => {
|
|
490
509
|
const _el$2 = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
|
|
491
|
-
$gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {
|
|
510
|
+
$gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {
|
|
511
|
+
height_: arrow_height_,
|
|
512
|
+
width_: arrow_width_
|
|
513
|
+
}));
|
|
492
514
|
return _el$2;
|
|
493
515
|
})()]
|
|
494
516
|
},
|
|
@@ -513,6 +535,8 @@ function $363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
|
513
535
|
const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
514
536
|
const num_placeholders_ = () => 20;
|
|
515
537
|
const slider = $gVhhF$solidjsweb.createComponent((0, $a0e53f99354809d9$export$6649caad96ef8870), {
|
|
538
|
+
arrow_height_: 25,
|
|
539
|
+
arrow_width_: 12.5,
|
|
516
540
|
disable_fading_: true,
|
|
517
541
|
slider_ref_: slider => {
|
|
518
542
|
const {
|
|
@@ -557,34 +581,66 @@ function $363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
|
557
581
|
children: slider
|
|
558
582
|
});
|
|
559
583
|
}
|
|
584
|
+
function $95837413165cc2df$export$23fca46f3143581f(component, error_message) {
|
|
585
|
+
const component_in_error_boundary = do_with_elements => {
|
|
586
|
+
const error_boundary_wrapped = $edafe91daf3091d7$export$b69d0d92862de18b({
|
|
587
|
+
severity_: "error",
|
|
588
|
+
message_: error_message,
|
|
589
|
+
get children() {
|
|
590
|
+
const elements = component();
|
|
591
|
+
do_with_elements?.(elements);
|
|
592
|
+
return elements;
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
// This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
|
|
596
|
+
if (typeof error_boundary_wrapped === "function")
|
|
597
|
+
// @ts-ignore
|
|
598
|
+
return error_boundary_wrapped();
|
|
599
|
+
// On the server it returns a string, so we just return that
|
|
600
|
+
return error_boundary_wrapped;
|
|
601
|
+
};
|
|
602
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
603
|
+
if (owner == null) return $gVhhF$solidjs.createRoot(dispose => {
|
|
604
|
+
// if we're not already run in a root, create a root and automatically dispose it when the first returned element is removed from the DOM
|
|
605
|
+
return component_in_error_boundary(elements => {
|
|
606
|
+
const have_multiple = Array.isArray(elements);
|
|
607
|
+
if (have_multiple ? !elements?.length : !elements) return;
|
|
608
|
+
(0, $gVhhF$depictaiutilishared.observer).onremoved(have_multiple ? elements[0] : elements, dispose);
|
|
609
|
+
});
|
|
610
|
+
});else
|
|
611
|
+
// we're already in a root so cleanups are handled
|
|
612
|
+
return component_in_error_boundary();
|
|
613
|
+
}
|
|
560
614
|
const $72f96c4782db0b1b$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict recommendations"></div>`, 2);
|
|
561
615
|
function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
|
|
562
|
-
|
|
563
|
-
const {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
grid_spacing
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
616
|
+
return $95837413165cc2df$export$23fca46f3143581f(() => {
|
|
617
|
+
const grid_spacing_override = $gVhhF$solidjs.createMemo(() => {
|
|
618
|
+
const {
|
|
619
|
+
grid_spacing: grid_spacing
|
|
620
|
+
} = props; // can be reactive
|
|
621
|
+
return typeof grid_spacing === "string" ? {
|
|
622
|
+
grid_spacing: grid_spacing
|
|
623
|
+
} : {
|
|
624
|
+
override_vertical_spacing: grid_spacing.vertical,
|
|
625
|
+
grid_spacing: grid_spacing.horizontal
|
|
626
|
+
};
|
|
627
|
+
});
|
|
628
|
+
const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
629
|
+
return (() => {
|
|
630
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($72f96c4782db0b1b$var$_tmpl$);
|
|
631
|
+
$gVhhF$solidjsweb.insert(_el$, () => $363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
632
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
633
|
+
recommendations_resource_: recommendations_resource_,
|
|
634
|
+
market_: () => props.market,
|
|
635
|
+
merchant_: () => props.merchant,
|
|
636
|
+
layout_options_: $gVhhF$solidjs.createMemo(() => ({
|
|
637
|
+
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
|
|
638
|
+
...grid_spacing_override()
|
|
639
|
+
}))
|
|
640
|
+
}));
|
|
641
|
+
return _el$;
|
|
642
|
+
})();
|
|
643
|
+
}, "RecommendationSlider failed");
|
|
588
644
|
}
|
|
589
645
|
const $b8e79813f4f7ebe4$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="recommendation-grid"><!#><!/><!#><!/></div>`, 6);
|
|
590
646
|
function $b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
@@ -647,46 +703,48 @@ function $b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
|
647
703
|
const $1f8dbf7e28b3eff2$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="show-more major" type="button"></button>`, 2),
|
|
648
704
|
$1f8dbf7e28b3eff2$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp recommendations"></div>`, 2);
|
|
649
705
|
function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
|
|
650
|
-
|
|
651
|
-
const
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
const {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
grid_spacing
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
706
|
+
return $95837413165cc2df$export$23fca46f3143581f(() => {
|
|
707
|
+
const rows_object_ = $gVhhF$solidjs.createMemo(() => {
|
|
708
|
+
const view_more_button = props.view_more_button;
|
|
709
|
+
if (!view_more_button) return "all";
|
|
710
|
+
return {
|
|
711
|
+
start_rows: view_more_button.start_rows,
|
|
712
|
+
rows_per_click: view_more_button.rows_per_click ?? 2,
|
|
713
|
+
button: (() => {
|
|
714
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($1f8dbf7e28b3eff2$var$_tmpl$);
|
|
715
|
+
$gVhhF$solidjsweb.insert(_el$, () => view_more_button.text);
|
|
716
|
+
return _el$;
|
|
717
|
+
})()
|
|
718
|
+
};
|
|
719
|
+
});
|
|
720
|
+
const grid_spacing_override = $gVhhF$solidjs.createMemo(() => {
|
|
721
|
+
const {
|
|
722
|
+
grid_spacing: grid_spacing
|
|
723
|
+
} = props; // can be reactive
|
|
724
|
+
return typeof grid_spacing === "string" ? {
|
|
725
|
+
grid_spacing: grid_spacing
|
|
726
|
+
} : {
|
|
727
|
+
override_vertical_spacing: grid_spacing.vertical,
|
|
728
|
+
grid_spacing: grid_spacing.horizontal
|
|
729
|
+
};
|
|
730
|
+
});
|
|
731
|
+
const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
732
|
+
return (() => {
|
|
733
|
+
const _el$2 = $gVhhF$solidjsweb.getNextElement($1f8dbf7e28b3eff2$var$_tmpl$2);
|
|
734
|
+
$gVhhF$solidjsweb.insert(_el$2, () => $b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
735
|
+
rows_object_: rows_object_,
|
|
736
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
737
|
+
recommendations_resource_: recommendations_resource_,
|
|
738
|
+
market_: () => props.market,
|
|
739
|
+
merchant_: () => props.merchant,
|
|
740
|
+
layout_options_: $gVhhF$solidjs.createMemo(() => ({
|
|
741
|
+
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
|
|
742
|
+
...grid_spacing_override()
|
|
743
|
+
}))
|
|
744
|
+
}));
|
|
745
|
+
return _el$2;
|
|
746
|
+
})();
|
|
747
|
+
}, "RecommendationGrid failed");
|
|
690
748
|
}
|
|
691
749
|
const $19950faaac026e09$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<img>`, 1);
|
|
692
750
|
function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
|
|
@@ -1358,7 +1416,7 @@ const $b3cf6ca8dc0e9998$export$48513f6b9f8ce62d = props => {
|
|
|
1358
1416
|
const label = $gVhhF$solidjs.createMemo(() => props.label_);
|
|
1359
1417
|
const checked = $gVhhF$solidjs.createMemo(() => props.checked_);
|
|
1360
1418
|
const value = $gVhhF$solidjs.createMemo(() => props.value_);
|
|
1361
|
-
const is_count_zero = $gVhhF$solidjs.createMemo(() => props.is_count_zero_);
|
|
1419
|
+
const is_count_zero = $gVhhF$solidjs.createMemo(() => props.is_count_zero_ || count() === 0);
|
|
1362
1420
|
const id = $gVhhF$depictaiutilishared.make_random_classname();
|
|
1363
1421
|
return (/* We can't use actual margin because ExpandingContainer gets messed up */(() => {
|
|
1364
1422
|
const _el$ = $gVhhF$solidjsweb.getNextElement($b3cf6ca8dc0e9998$var$_tmpl$2),
|
|
@@ -1394,14 +1452,17 @@ const $b3cf6ca8dc0e9998$export$48513f6b9f8ce62d = props => {
|
|
|
1394
1452
|
}
|
|
1395
1453
|
}), _el$8, _co$);
|
|
1396
1454
|
$gVhhF$solidjsweb.effect(_p$ => {
|
|
1397
|
-
const _v$ = !!
|
|
1398
|
-
_v$2 = value()
|
|
1455
|
+
const _v$ = !!is_count_zero(),
|
|
1456
|
+
_v$2 = value(),
|
|
1457
|
+
_v$3 = !checked() && is_count_zero();
|
|
1399
1458
|
_v$ !== _p$._v$ && _el$.classList.toggle("count-0", _p$._v$ = _v$);
|
|
1400
1459
|
_v$2 !== _p$._v$2 && $gVhhF$solidjsweb.setAttribute(_el$3, "name", _p$._v$2 = _v$2);
|
|
1460
|
+
_v$3 !== _p$._v$3 && (_el$3.disabled = _p$._v$3 = _v$3);
|
|
1401
1461
|
return _p$;
|
|
1402
1462
|
}, {
|
|
1403
1463
|
_v$: undefined,
|
|
1404
|
-
_v$2: undefined
|
|
1464
|
+
_v$2: undefined,
|
|
1465
|
+
_v$3: undefined
|
|
1405
1466
|
});
|
|
1406
1467
|
$gVhhF$solidjsweb.effect(() => _el$3.checked = checked());
|
|
1407
1468
|
return _el$;
|
|
@@ -2238,6 +2299,7 @@ function $3bdc00a1353c1150$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
2238
2299
|
return $gVhhF$solidjs.createMemo(() => value()?.is_expanded_?.ui_should_show_expanded_?.() ?? false);
|
|
2239
2300
|
}
|
|
2240
2301
|
}), _el$16, _co$5);
|
|
2302
|
+
$gVhhF$solidjsweb.effect(() => _el$14.classList.toggle("count-0", !!(value()?.count_ === 0)));
|
|
2241
2303
|
return _el$12;
|
|
2242
2304
|
})();
|
|
2243
2305
|
},
|
|
@@ -2429,7 +2491,8 @@ function $3bdc00a1353c1150$var$expand_until_choice(data_structure) {
|
|
|
2429
2491
|
});
|
|
2430
2492
|
}
|
|
2431
2493
|
const $0ef1681699140f1a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="checkbox-grid"></div>`, 2),
|
|
2432
|
-
$0ef1681699140f1a$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<
|
|
2494
|
+
$0ef1681699140f1a$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span class="count-wrapper"><span class="count"></span></span>`, 4),
|
|
2495
|
+
$0ef1681699140f1a$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="major-minor-transition"><!#><!/><!#><!/></button>`, 6);
|
|
2433
2496
|
const $0ef1681699140f1a$export$414f6a19d38e655c = ({
|
|
2434
2497
|
filter_: filter_,
|
|
2435
2498
|
selected_filters_: [get_selected_filters, set_selected_filters]
|
|
@@ -2461,7 +2524,11 @@ const $0ef1681699140f1a$export$414f6a19d38e655c = ({
|
|
|
2461
2524
|
children: value => {
|
|
2462
2525
|
const is_selected = $gVhhF$solidjs.createMemo(() => existing_filter()?.data?.includes(value().value_));
|
|
2463
2526
|
return (() => {
|
|
2464
|
-
const _el$2 = $gVhhF$solidjsweb.getNextElement($0ef1681699140f1a$var$_tmpl$
|
|
2527
|
+
const _el$2 = $gVhhF$solidjsweb.getNextElement($0ef1681699140f1a$var$_tmpl$3),
|
|
2528
|
+
_el$5 = _el$2.firstChild,
|
|
2529
|
+
[_el$6, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$5.nextSibling),
|
|
2530
|
+
_el$7 = _el$6.nextSibling,
|
|
2531
|
+
[_el$8, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$7.nextSibling);
|
|
2465
2532
|
$gVhhF$solidjsweb.addEventListener(_el$2, "click", $gVhhF$depictaiutilishared.catchify(() => {
|
|
2466
2533
|
const set_filter = existing_filter();
|
|
2467
2534
|
const {
|
|
@@ -2482,16 +2549,30 @@ const $0ef1681699140f1a$export$414f6a19d38e655c = ({
|
|
|
2482
2549
|
const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
|
|
2483
2550
|
set_selected_filters(selected_filters);
|
|
2484
2551
|
}), true);
|
|
2485
|
-
$gVhhF$solidjsweb.insert(_el$2, () => value().value_);
|
|
2552
|
+
$gVhhF$solidjsweb.insert(_el$2, () => value().value_, _el$6, _co$);
|
|
2553
|
+
$gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
2554
|
+
get when() {
|
|
2555
|
+
return value().count_ != undefined;
|
|
2556
|
+
},
|
|
2557
|
+
get children() {
|
|
2558
|
+
const _el$3 = $gVhhF$solidjsweb.getNextElement($0ef1681699140f1a$var$_tmpl$2),
|
|
2559
|
+
_el$4 = _el$3.firstChild;
|
|
2560
|
+
$gVhhF$solidjsweb.insert(_el$4, () => value().count_);
|
|
2561
|
+
return _el$3;
|
|
2562
|
+
}
|
|
2563
|
+
}), _el$8, _co$2);
|
|
2486
2564
|
$gVhhF$solidjsweb.effect(_p$ => {
|
|
2487
|
-
const _v$ = !is_selected(),
|
|
2488
|
-
_v$2 =
|
|
2489
|
-
|
|
2490
|
-
_v$
|
|
2565
|
+
const _v$ = value().count_ === 0 && !is_selected(),
|
|
2566
|
+
_v$2 = !is_selected(),
|
|
2567
|
+
_v$3 = !!is_selected();
|
|
2568
|
+
_v$ !== _p$._v$ && (_el$2.disabled = _p$._v$ = _v$);
|
|
2569
|
+
_v$2 !== _p$._v$2 && _el$2.classList.toggle("minor", _p$._v$2 = _v$2);
|
|
2570
|
+
_v$3 !== _p$._v$3 && _el$2.classList.toggle("major", _p$._v$3 = _v$3);
|
|
2491
2571
|
return _p$;
|
|
2492
2572
|
}, {
|
|
2493
2573
|
_v$: undefined,
|
|
2494
|
-
_v$2: undefined
|
|
2574
|
+
_v$2: undefined,
|
|
2575
|
+
_v$3: undefined
|
|
2495
2576
|
});
|
|
2496
2577
|
$gVhhF$solidjsweb.runHydrationEvents();
|
|
2497
2578
|
return _el$2;
|
|
@@ -6317,35 +6398,6 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
6317
6398
|
return _el$13;
|
|
6318
6399
|
})()];
|
|
6319
6400
|
}
|
|
6320
|
-
function $95837413165cc2df$export$23fca46f3143581f(component, error_message) {
|
|
6321
|
-
const component_in_error_boundary = do_with_elements => {
|
|
6322
|
-
const error_boundary_wrapped = $edafe91daf3091d7$export$b69d0d92862de18b({
|
|
6323
|
-
severity_: "error",
|
|
6324
|
-
message_: error_message,
|
|
6325
|
-
get children() {
|
|
6326
|
-
const elements = component();
|
|
6327
|
-
do_with_elements?.(elements);
|
|
6328
|
-
return elements;
|
|
6329
|
-
}
|
|
6330
|
-
});
|
|
6331
|
-
// This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
|
|
6332
|
-
if (typeof error_boundary_wrapped === "function")
|
|
6333
|
-
// @ts-ignore
|
|
6334
|
-
return error_boundary_wrapped();
|
|
6335
|
-
// On the server it returns a string, so we just return that
|
|
6336
|
-
return error_boundary_wrapped;
|
|
6337
|
-
};
|
|
6338
|
-
const owner = $gVhhF$solidjs.getOwner();
|
|
6339
|
-
if (owner == null) return $gVhhF$solidjs.createRoot(dispose => {
|
|
6340
|
-
// if we're not already run in a root, create a root and automatically dispose it when the first returned element is removed from the DOM
|
|
6341
|
-
return component_in_error_boundary(elements => {
|
|
6342
|
-
if (!elements?.length) return;
|
|
6343
|
-
(0, $gVhhF$depictaiutilishared.observer).onremoved(elements[0], dispose);
|
|
6344
|
-
});
|
|
6345
|
-
});else
|
|
6346
|
-
// we're already in a root so cleanups are handled
|
|
6347
|
-
return component_in_error_boundary();
|
|
6348
|
-
}
|
|
6349
6401
|
function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
6350
6402
|
const router_ = options.router_;
|
|
6351
6403
|
const search_query_url_param_name_ = "search_query_url_param_name_" in options ? options.search_query_url_param_name_ : undefined;
|
|
@@ -7991,7 +8043,7 @@ function $c0125412b4ea0c93$export$605674723bcc715c(props = {}) {
|
|
|
7991
8043
|
const $6b65ba8af12c5a26$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<a class="suggestion"></a>`, 2),
|
|
7992
8044
|
$6b65ba8af12c5a26$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="search-icon"></div>`, 2),
|
|
7993
8045
|
$6b65ba8af12c5a26$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span class="type"></span>`, 2),
|
|
7994
|
-
$6b65ba8af12c5a26$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div><!#><!/><span class="value"></span></div>`, 6),
|
|
8046
|
+
$6b65ba8af12c5a26$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="with-parent-title"><!#><!/><span class="value line-clamp"></span></div>`, 6),
|
|
7995
8047
|
$6b65ba8af12c5a26$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="with-icon"><!#><!/><!#><!/></div>`, 6),
|
|
7996
8048
|
$6b65ba8af12c5a26$var$_tmpl$6 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<h2 class="text"></h2>`, 2),
|
|
7997
8049
|
$6b65ba8af12c5a26$var$_tmpl$7 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="suggestion-container query"><!#><!/><!#><!/></div>`, 6),
|
|
@@ -9319,7 +9371,9 @@ function $76227de40be817e5$export$f631859cab12b342({
|
|
|
9319
9371
|
}
|
|
9320
9372
|
function $8781fcec27b20709$export$9ff751cd77687edc({
|
|
9321
9373
|
search_results_: search_results_,
|
|
9322
|
-
router_: router_
|
|
9374
|
+
router_: router_,
|
|
9375
|
+
queries_without_content_results_: queries_without_content_results_,
|
|
9376
|
+
get_search_query_: get_search_query_
|
|
9323
9377
|
}) {
|
|
9324
9378
|
const content_results = $gVhhF$solidjs.createMemo(() => search_results_()?.content_search_links);
|
|
9325
9379
|
const content_results_by_page_url = $gVhhF$solidjs.createMemo(() => {
|
|
@@ -9332,6 +9386,10 @@ function $8781fcec27b20709$export$9ff751cd77687edc({
|
|
|
9332
9386
|
}
|
|
9333
9387
|
return map;
|
|
9334
9388
|
});
|
|
9389
|
+
$gVhhF$solidjs.createEffect(() => {
|
|
9390
|
+
const results = content_results();
|
|
9391
|
+
if (Array.isArray(results) && results.length === 0) queries_without_content_results_.add($gVhhF$solidjs.untrack(get_search_query_));
|
|
9392
|
+
});
|
|
9335
9393
|
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.For), {
|
|
9336
9394
|
get each() {
|
|
9337
9395
|
return [...content_results_by_page_url().keys()];
|
|
@@ -9384,8 +9442,15 @@ function $3716b8caf7f959e2$export$6d0c9c22f6652669({
|
|
|
9384
9442
|
number_: num_results,
|
|
9385
9443
|
i18n_: i18n_
|
|
9386
9444
|
});
|
|
9387
|
-
const
|
|
9445
|
+
const queries_without_content_results_ = new (0, $gVhhF$depictaiutilishared.ListenableSet)();
|
|
9446
|
+
const [check_query, set_check_query] = $gVhhF$solidjs.createSignal(false);
|
|
9447
|
+
const placeholders_enabled = $gVhhF$solidjs.createMemo(() => {
|
|
9448
|
+
// don't show placeholders when the user toggles filters
|
|
9449
|
+
check_query();
|
|
9450
|
+
return !queries_without_content_results_.has(get_search_query_());
|
|
9451
|
+
});
|
|
9388
9452
|
const rows_object = $3716b8caf7f959e2$var$make_state_saved_rows(content_results_rows_, i18n_);
|
|
9453
|
+
for (const ev of ["add", "delete"]) queries_without_content_results_.addEventListener(ev, () => set_check_query(prev => !prev));
|
|
9389
9454
|
return (() => {
|
|
9390
9455
|
const _el$ = $gVhhF$solidjsweb.getNextElement($3716b8caf7f959e2$var$_tmpl$),
|
|
9391
9456
|
_el$2 = _el$.firstChild,
|
|
@@ -9411,36 +9476,25 @@ function $3716b8caf7f959e2$export$6d0c9c22f6652669({
|
|
|
9411
9476
|
get children() {
|
|
9412
9477
|
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
9413
9478
|
get fallback() {
|
|
9414
|
-
return (()
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
return $gVhhF$solidjs.createMemo(() => layout_options_().cols_at_size);
|
|
9421
|
-
}
|
|
9422
|
-
});
|
|
9423
|
-
})();
|
|
9479
|
+
return $gVhhF$solidjsweb.createComponent((0, $c2f92eb265a14529$export$4405d077f0a20494), {
|
|
9480
|
+
content_results_rows_: content_results_rows_,
|
|
9481
|
+
get cols_at_size_() {
|
|
9482
|
+
return $gVhhF$solidjs.createMemo(() => layout_options_().cols_at_size);
|
|
9483
|
+
}
|
|
9484
|
+
});
|
|
9424
9485
|
},
|
|
9425
9486
|
get children() {
|
|
9426
9487
|
return $gVhhF$solidjsweb.createComponent((0, $8781fcec27b20709$export$9ff751cd77687edc), {
|
|
9427
9488
|
router_: router_,
|
|
9428
|
-
search_results_: search_results_
|
|
9489
|
+
search_results_: search_results_,
|
|
9490
|
+
queries_without_content_results_: queries_without_content_results_,
|
|
9491
|
+
get_search_query_: get_search_query_
|
|
9429
9492
|
});
|
|
9430
9493
|
}
|
|
9431
9494
|
});
|
|
9432
9495
|
}
|
|
9433
9496
|
})), _el$5, _co$2);
|
|
9434
|
-
$gVhhF$solidjsweb.effect(
|
|
9435
|
-
const _v$ = !!is_showing_placeholders(),
|
|
9436
|
-
_v$2 = is_loading_() || content_results()?.length > 0 ? "" : "none";
|
|
9437
|
-
_v$ !== _p$._v$ && _el$.classList.toggle("loading", _p$._v$ = _v$);
|
|
9438
|
-
_v$2 !== _p$._v$2 && _el$.style.setProperty("display", _p$._v$2 = _v$2);
|
|
9439
|
-
return _p$;
|
|
9440
|
-
}, {
|
|
9441
|
-
_v$: undefined,
|
|
9442
|
-
_v$2: undefined
|
|
9443
|
-
});
|
|
9497
|
+
$gVhhF$solidjsweb.effect(() => _el$.style.setProperty("display", is_loading_() && placeholders_enabled() || content_results()?.length > 0 ? "" : "none"));
|
|
9444
9498
|
return _el$;
|
|
9445
9499
|
})();
|
|
9446
9500
|
}
|
|
@@ -9875,7 +9929,7 @@ const $2c61e4cd8229c49a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<d
|
|
|
9875
9929
|
* Type for the private properties that are shared between the different exported search SDK wrapper functions. SDK users are not allowed to change/access these, they're an internal implementation detail.
|
|
9876
9930
|
*/
|
|
9877
9931
|
const $2c61e4cd8229c49a$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
|
|
9878
|
-
const $2c61e4cd8229c49a$var$content_search_default =
|
|
9932
|
+
const $2c61e4cd8229c49a$var$content_search_default = true;
|
|
9879
9933
|
const $2c61e4cd8229c49a$var$min_products_to_fetch_ = 20;
|
|
9880
9934
|
const $2c61e4cd8229c49a$export$bde3eb976dfded9 = depict_search => $2c61e4cd8229c49a$var$privately_shared_properties.get(depict_search)?.search_query_updating_blocked_;
|
|
9881
9935
|
class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|