@depict-ai/ui 1.4.24 → 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.js CHANGED
@@ -1,7 +1,6 @@
1
- import { add_to_version_info as $8tj43$add_to_version_info, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, catchify as $8tj43$catchify, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, slider_fading_factory as $8tj43$slider_fading_factory, is_safari as $8tj43$is_safari, observer as $8tj43$observer, useExpandingContainer as $8tj43$useExpandingContainer, standard_price_format as $8tj43$standard_price_format, dlog as $8tj43$dlog, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, javascript_media_query as $8tj43$javascript_media_query, fetch_recs as $8tj43$fetch_recs, snakeCasifyObject as $8tj43$snakeCasifyObject, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, base_url as $8tj43$base_url, get_depict_id as $8tj43$get_depict_id, get_user_id as $8tj43$get_user_id, get_session_id as $8tj43$get_session_id, make_url_with_query_params as $8tj43$make_url_with_query_params, fetch_retry as $8tj43$fetch_retry, add_version_query_params as $8tj43$add_version_query_params, dwarn as $8tj43$dwarn, sort_obj as $8tj43$sort_obj, edit_current_page_meta_tags as $8tj43$edit_current_page_meta_tags, use_href_accessor as $8tj43$use_href_accessor, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, queueMacroTask as $8tj43$queueMacroTask, is_debug as $8tj43$is_debug, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, deparallelize_no_drop as $8tj43$deparallelize_no_drop, insert_surfaces as $8tj43$insert_surfaces } from "@depict-ai/utilishared/ES10";
1
+ import { add_to_version_info as $8tj43$add_to_version_info, slider_fractional_factory as $8tj43$slider_fractional_factory, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, catchify as $8tj43$catchify, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, slider_fading_factory as $8tj43$slider_fading_factory, observer as $8tj43$observer, is_safari as $8tj43$is_safari, useExpandingContainer as $8tj43$useExpandingContainer, standard_price_format as $8tj43$standard_price_format, dlog as $8tj43$dlog, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, javascript_media_query as $8tj43$javascript_media_query, fetch_recs as $8tj43$fetch_recs, snakeCasifyObject as $8tj43$snakeCasifyObject, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, base_url as $8tj43$base_url, get_depict_id as $8tj43$get_depict_id, get_user_id as $8tj43$get_user_id, get_session_id as $8tj43$get_session_id, make_url_with_query_params as $8tj43$make_url_with_query_params, fetch_retry as $8tj43$fetch_retry, add_version_query_params as $8tj43$add_version_query_params, dwarn as $8tj43$dwarn, sort_obj as $8tj43$sort_obj, edit_current_page_meta_tags as $8tj43$edit_current_page_meta_tags, use_href_accessor as $8tj43$use_href_accessor, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, queueMacroTask as $8tj43$queueMacroTask, is_debug as $8tj43$is_debug, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, deparallelize_no_drop as $8tj43$deparallelize_no_drop, ListenableSet as $8tj43$ListenableSet, insert_surfaces as $8tj43$insert_surfaces } from "@depict-ai/utilishared/ES10";
2
2
  import { template as $8tj43$template, getNextElement as $8tj43$getNextElement, insert as $8tj43$insert, createComponent as $8tj43$createComponent, mergeProps as $8tj43$mergeProps, isServer as $8tj43$isServer, spread as $8tj43$spread, runHydrationEvents as $8tj43$runHydrationEvents, addEventListener as $8tj43$addEventListener, className as $8tj43$className, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, effect as $8tj43$effect, classList as $8tj43$classList, setAttribute as $8tj43$setAttribute, getNextMarker as $8tj43$getNextMarker, style as $8tj43$style, Dynamic as $8tj43$Dynamic, use as $8tj43$use } from "solid-js/web";
3
- import { createMemo as $8tj43$createMemo, createResource as $8tj43$createResource, Suspense as $8tj43$Suspense, Show as $8tj43$Show, createSignal as $8tj43$createSignal, createRenderEffect as $8tj43$createRenderEffect, createRoot as $8tj43$createRoot, onCleanup as $8tj43$onCleanup, For as $8tj43$For, getOwner as $8tj43$getOwner, runWithOwner as $8tj43$runWithOwner, createEffect as $8tj43$createEffect, untrack as $8tj43$untrack, createComputed as $8tj43$createComputed, ErrorBoundary as $8tj43$ErrorBoundary, Index as $8tj43$Index, on as $8tj43$on, batch as $8tj43$batch, createReaction as $8tj43$createReaction } from "solid-js";
4
- import { slider_fractional_factory as $8tj43$slider_fractional_factory } from "@depict-ai/utilishared/latest/ES10";
3
+ import { createMemo as $8tj43$createMemo, createResource as $8tj43$createResource, Suspense as $8tj43$Suspense, Show as $8tj43$Show, createSignal as $8tj43$createSignal, createRenderEffect as $8tj43$createRenderEffect, createRoot as $8tj43$createRoot, onCleanup as $8tj43$onCleanup, For as $8tj43$For, getOwner as $8tj43$getOwner, runWithOwner as $8tj43$runWithOwner, createEffect as $8tj43$createEffect, untrack as $8tj43$untrack, createUniqueId as $8tj43$createUniqueId, createComputed as $8tj43$createComputed, ErrorBoundary as $8tj43$ErrorBoundary, Index as $8tj43$Index, on as $8tj43$on, batch as $8tj43$batch, createReaction as $8tj43$createReaction } from "solid-js";
5
4
  import $8tj43$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
6
5
  import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
7
6
  import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
@@ -9,7 +8,7 @@ import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
9
8
  /*! Depict.ai search and product listing SDK */
10
9
  import { register_es_version } from "../multi_import_deduplicator.mjs";
11
10
  register_es_version("ui", "ES10");
12
- const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.24";
11
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0.0";
13
12
  const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
14
13
  const cols_at_size = [];
15
14
  for (let i = 0; i < sorted_cols_at_size.length; i++) {
@@ -83,7 +82,9 @@ function $3f7203368ad0d3ca$export$ff7109b9b2b206ba(sdk_cols_at_size) {
83
82
  }
84
83
  function $ca55612a53dbbdd2$export$a2cc176055f8f08() {
85
84
  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.";
86
- return (0, $8tj43$isServer) ? "<!-- ".concat(text, " -->") : document.createComment(text);
85
+ return (0, $8tj43$isServer) ? {
86
+ t: "<!-- ".concat(text, " -->")
87
+ } : document.createComment(text);
87
88
  }
88
89
  function $cb64b315b25cfc59$export$2f0cbfbb4354bb52(elements) {
89
90
  // FYI this probably doesn't work on hugely deep nestings or large amount of elements
@@ -309,9 +310,14 @@ function $74777e8fe65b3dcb$export$b69d0d92862de18b(props) {
309
310
  const $63f1f8dbcd07d3b0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2),
310
311
  $63f1f8dbcd07d3b0$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<style type="text/css"></style>`, 2);
311
312
  function $63f1f8dbcd07d3b0$export$d21e32dfedac04be(props) {
313
+ const container_class = "x" + $8tj43$createUniqueId();
312
314
  const container_element_ = (() => {
313
315
  const _el$ = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
314
- $8tj43$spread(_el$, $8tj43$mergeProps(() => props.element_attributes), false, true);
316
+ $8tj43$spread(_el$, $8tj43$mergeProps(() => props.element_attributes, {
317
+ "classList": {
318
+ [container_class]: true
319
+ }
320
+ }), false, true);
315
321
  $8tj43$insert(_el$, () => props.children);
316
322
  $8tj43$runHydrationEvents();
317
323
  return _el$;
@@ -322,12 +328,18 @@ function $63f1f8dbcd07d3b0$export$d21e32dfedac04be(props) {
322
328
  },
323
329
  severity_: "error",
324
330
  get children() {
325
- return $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element_);
331
+ return $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element_, false, container_class);
326
332
  }
327
333
  });
328
334
  }
329
335
  function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
330
336
  let insert_after_container = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
337
+ let container_class = arguments.length > 3 ? arguments[3] : undefined;
338
+ if (!container_class) {
339
+ // only try to add if it wasn't provided, so that we have a code path without classList when doing SSR
340
+ container_class = $8tj43$make_random_classname();
341
+ container_element.classList.add(container_class);
342
+ }
331
343
  // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
332
344
  const show_all_rows = $8tj43$createMemo(() => props.rows === "all");
333
345
  const rows_or_empty_object = $8tj43$createMemo(() => show_all_rows() ? {} : props.rows);
@@ -342,10 +354,9 @@ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
342
354
  return !(!button || Array.isArray(button) && !button.length);
343
355
  });
344
356
  const [get_styling, set_styling] = $8tj43$createSignal();
345
- const container_class = $8tj43$make_random_classname();
346
357
  const selector_beginning = ".depict .".concat(container_class, ">"); // class so ppl can have id if needed
347
358
  const [get_children_count, set_children_count] = $8tj43$createSignal(0);
348
- const update_children_count = () => set_children_count(container_element.children.length);
359
+ const update_children_count = () => (0, $8tj43$isServer) ? 20 : set_children_count(container_element.children.length);
349
360
  const col_styling = $8tj43$createMemo(() => $8tj43$n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
350
361
  const default_currently_visible_signal = $8tj43$createSignal($8tj43$untrack(() => {
351
362
  var _rows_or_empty_object;
@@ -354,43 +365,39 @@ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
354
365
  const rows_visible_signal = $8tj43$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
355
366
  const get_rows_visible = $8tj43$createMemo(() => rows_visible_signal()[0]());
356
367
  const set_rows_visible = $8tj43$createMemo(() => rows_visible_signal()[1]);
357
- const view_more_button_class = $8tj43$make_random_classname();
358
- const view_less_button_class = $8tj43$make_random_classname();
359
- const style_element = (() => {
360
- const _el$2 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$2);
361
- $8tj43$insert(_el$2, get_styling);
362
- return _el$2;
363
- })();
368
+ const view_more_button_class = "m" + $8tj43$createUniqueId();
369
+ const view_less_button_class = "l" + $8tj43$createUniqueId(); // https://github.com/solidjs/solid-docs/issues/263#issuecomment-1622388079
364
370
  const view_more_button_container = $8tj43$createMemo(() => have_a_view_more_button() && (() => {
365
- const _el$3 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
366
- $8tj43$addEventListener(_el$3, "click", $8tj43$catchify(() => set_rows_visible()(prev => {
371
+ const _el$2 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
372
+ $8tj43$addEventListener(_el$2, "click", $8tj43$catchify(() => set_rows_visible()(prev => {
367
373
  var _rows_or_empty_object2;
368
374
  return prev + ((_rows_or_empty_object2 = rows_or_empty_object().rows_per_click) !== null && _rows_or_empty_object2 !== void 0 ? _rows_or_empty_object2 : 1);
369
375
  })), true);
370
- $8tj43$className(_el$3, "load-more-container ".concat(view_more_button_class));
371
- $8tj43$insert(_el$3, () => rows_or_empty_object().button);
376
+ $8tj43$className(_el$2, "load-more-container ".concat(view_more_button_class));
377
+ $8tj43$insert(_el$2, () => rows_or_empty_object().button);
372
378
  $8tj43$runHydrationEvents();
373
- return _el$3;
379
+ return _el$2;
374
380
  })());
375
381
  // 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
376
382
  const view_less_button_container = $8tj43$createMemo(() => have_a_view_less_button() && (() => {
377
- const _el$4 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
378
- $8tj43$addEventListener(_el$4, "click", $8tj43$catchify(() => set_rows_visible()(() => {
383
+ const _el$3 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
384
+ $8tj43$addEventListener(_el$3, "click", $8tj43$catchify(() => set_rows_visible()(() => {
379
385
  var _rows_or_empty_object3;
380
386
  return (_rows_or_empty_object3 = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object3 !== void 0 ? _rows_or_empty_object3 : 1;
381
387
  })), true);
382
- $8tj43$className(_el$4, "load-less-container ".concat(view_less_button_class));
383
- $8tj43$insert(_el$4, () => rows_or_empty_object().view_less_button);
388
+ $8tj43$className(_el$3, "load-less-container ".concat(view_less_button_class));
389
+ $8tj43$insert(_el$3, () => rows_or_empty_object().view_less_button);
384
390
  $8tj43$runHydrationEvents();
385
- return _el$4;
391
+ return _el$3;
386
392
  })());
387
- container_element.classList.add(container_class);
393
+ const [force_style_update, set_force_style_update] = $8tj43$createSignal("");
388
394
  $8tj43$createComputed(() => {
389
395
  // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
390
396
  const rows_visible = get_rows_visible();
391
397
  const max_rows = rows_or_empty_object().max_rows;
392
398
  if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
393
399
  });
400
+ $8tj43$createEffect(() => set_force_style_update(" ")); // force style update after hydration due to https://discord.com/channels/722131463138705510/722167424186843267/1151544212517552168
394
401
  $8tj43$createRenderEffect(() => {
395
402
  // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
396
403
  if (show_all_rows()) {
@@ -399,11 +406,13 @@ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
399
406
  return;
400
407
  }
401
408
  update_children_count();
402
- const mutation_observer = new MutationObserver($8tj43$catchify(update_children_count));
403
- mutation_observer.observe(container_element, {
404
- childList: true
405
- });
406
- $8tj43$onCleanup(() => mutation_observer.disconnect());
409
+ if (!(0, $8tj43$isServer)) {
410
+ const mutation_observer = new MutationObserver($8tj43$catchify(update_children_count));
411
+ mutation_observer.observe(container_element, {
412
+ childList: true
413
+ });
414
+ $8tj43$onCleanup(() => mutation_observer.disconnect());
415
+ }
407
416
  set_styling(
408
417
  // this is needed because solid will think that the memo-accessor is a setter function otherwise
409
418
  () => $8tj43$createMemo(() => {
@@ -414,7 +423,7 @@ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
414
423
  } = rows_or_empty_object();
415
424
  const rows_visible = get_rows_visible();
416
425
  const children_count = get_children_count();
417
- return col_styling() + props.cols_at_size.map(options => {
426
+ return force_style_update() + col_styling() + props.cols_at_size.map(options => {
418
427
  const [recs_per_row, min, max] = options;
419
428
  let should_hide_view_more_button;
420
429
  let visible_recs;
@@ -435,6 +444,11 @@ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
435
444
  }).join("");
436
445
  }));
437
446
  });
447
+ const style_element = (() => {
448
+ const _el$4 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$2);
449
+ $8tj43$insert(_el$4, get_styling);
450
+ return _el$4;
451
+ })(); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
438
452
  if (insert_after_container) container_element.after(style_element);
439
453
  return [container_element, $8tj43$memo(view_more_button_container), $8tj43$memo(view_less_button_container), style_element];
440
454
  }
@@ -465,18 +479,26 @@ function $002f09d00aac50b2$export$6649caad96ef8870(_ref) {
465
479
  slider_ref_: slider_ref_,
466
480
  faded_opacity_ = 0.7,
467
481
  mutation_plugins_ = [],
468
- disable_fading_: disable_fading_
482
+ disable_fading_: disable_fading_,
483
+ arrow_width_: arrow_width_,
484
+ arrow_height_: arrow_height_
469
485
  } = _ref;
470
486
  const slider = new (0, $8tj43$Amazing_Slider)({
471
487
  button_contents: {
472
488
  left: [(() => {
473
489
  const _el$ = $8tj43$getNextElement($002f09d00aac50b2$var$_tmpl$);
474
- $8tj43$insert(_el$, $8tj43$createComponent((0, $ca6ab5f08bd28bca$export$8be2714ec7f169ee), {}));
490
+ $8tj43$insert(_el$, $8tj43$createComponent((0, $ca6ab5f08bd28bca$export$8be2714ec7f169ee), {
491
+ height_: arrow_height_,
492
+ width_: arrow_width_
493
+ }));
475
494
  return _el$;
476
495
  })()],
477
496
  right: [(() => {
478
497
  const _el$2 = $8tj43$getNextElement($002f09d00aac50b2$var$_tmpl$);
479
- $8tj43$insert(_el$2, $8tj43$createComponent((0, $ca6ab5f08bd28bca$export$8be2714ec7f169ee), {}));
498
+ $8tj43$insert(_el$2, $8tj43$createComponent((0, $ca6ab5f08bd28bca$export$8be2714ec7f169ee), {
499
+ height_: arrow_height_,
500
+ width_: arrow_width_
501
+ }));
480
502
  return _el$2;
481
503
  })()]
482
504
  },
@@ -505,6 +527,8 @@ function $39ddb986053fb759$export$d41d19e89346fa2(_ref) {
505
527
  });
506
528
  const num_placeholders_ = () => 20;
507
529
  const slider = $8tj43$createComponent((0, $002f09d00aac50b2$export$6649caad96ef8870), {
530
+ arrow_height_: 25,
531
+ arrow_width_: 12.5,
508
532
  disable_fading_: true,
509
533
  slider_ref_: slider => {
510
534
  const {
@@ -549,36 +573,68 @@ function $39ddb986053fb759$export$d41d19e89346fa2(_ref) {
549
573
  children: slider
550
574
  });
551
575
  }
576
+ function $83e8cf2c0b87a58a$export$23fca46f3143581f(component, error_message) {
577
+ const component_in_error_boundary = do_with_elements => {
578
+ const error_boundary_wrapped = $74777e8fe65b3dcb$export$b69d0d92862de18b({
579
+ severity_: "error",
580
+ message_: error_message,
581
+ get children() {
582
+ const elements = component();
583
+ do_with_elements === null || do_with_elements === void 0 || do_with_elements(elements);
584
+ return elements;
585
+ }
586
+ });
587
+ // This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
588
+ if (typeof error_boundary_wrapped === "function")
589
+ // @ts-ignore
590
+ return error_boundary_wrapped();
591
+ // On the server it returns a string, so we just return that
592
+ return error_boundary_wrapped;
593
+ };
594
+ const owner = $8tj43$getOwner();
595
+ if (owner == null) return $8tj43$createRoot(dispose => {
596
+ // 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
597
+ return component_in_error_boundary(elements => {
598
+ const have_multiple = Array.isArray(elements);
599
+ if (have_multiple ? !(elements !== null && elements !== void 0 && elements.length) : !elements) return;
600
+ (0, $8tj43$observer).onremoved(have_multiple ? elements[0] : elements, dispose);
601
+ });
602
+ });else
603
+ // we're already in a root so cleanups are handled
604
+ return component_in_error_boundary();
605
+ }
552
606
  const $d5d7e58c5c9d8db0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="depict recommendations"></div>`, 2);
553
607
  function $d5d7e58c5c9d8db0$export$9574e176201e5e8d(props) {
554
- const grid_spacing_override = $8tj43$createMemo(() => {
555
- const {
556
- grid_spacing: grid_spacing
557
- } = props; // can be reactive
558
- return typeof grid_spacing === "string" ? {
559
- grid_spacing: grid_spacing
560
- } : {
561
- override_vertical_spacing: grid_spacing.vertical,
562
- grid_spacing: grid_spacing.horizontal
563
- };
564
- });
565
- const [recommendations_resource_] = $8tj43$createResource(() => props.recommendations, recs => recs);
566
- return (() => {
567
- const _el$ = $8tj43$getNextElement($d5d7e58c5c9d8db0$var$_tmpl$);
568
- $8tj43$insert(_el$, () => $39ddb986053fb759$export$d41d19e89346fa2({
569
- product_card_template_: function () {
570
- return props.product_card_template(...arguments);
571
- },
572
- recommendations_resource_: recommendations_resource_,
573
- market_: () => props.market,
574
- merchant_: () => props.merchant,
575
- layout_options_: $8tj43$createMemo(() => ({
576
- cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77($3f7203368ad0d3ca$export$ff7109b9b2b206ba(props.cols_at_size)),
577
- ...grid_spacing_override()
578
- }))
579
- }));
580
- return _el$;
581
- })();
608
+ return $83e8cf2c0b87a58a$export$23fca46f3143581f(() => {
609
+ const grid_spacing_override = $8tj43$createMemo(() => {
610
+ const {
611
+ grid_spacing: grid_spacing
612
+ } = props; // can be reactive
613
+ return typeof grid_spacing === "string" ? {
614
+ grid_spacing: grid_spacing
615
+ } : {
616
+ override_vertical_spacing: grid_spacing.vertical,
617
+ grid_spacing: grid_spacing.horizontal
618
+ };
619
+ });
620
+ const [recommendations_resource_] = $8tj43$createResource(() => props.recommendations, recs => recs);
621
+ return (() => {
622
+ const _el$ = $8tj43$getNextElement($d5d7e58c5c9d8db0$var$_tmpl$);
623
+ $8tj43$insert(_el$, () => $39ddb986053fb759$export$d41d19e89346fa2({
624
+ product_card_template_: function () {
625
+ return props.product_card_template(...arguments);
626
+ },
627
+ recommendations_resource_: recommendations_resource_,
628
+ market_: () => props.market,
629
+ merchant_: () => props.merchant,
630
+ layout_options_: $8tj43$createMemo(() => ({
631
+ cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77($3f7203368ad0d3ca$export$ff7109b9b2b206ba(props.cols_at_size)),
632
+ ...grid_spacing_override()
633
+ }))
634
+ }));
635
+ return _el$;
636
+ })();
637
+ }, "RecommendationSlider failed");
582
638
  }
583
639
  const $e3efeb558d952696$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="recommendation-grid"><!#><!/><!#><!/></div>`, 6);
584
640
  function $e3efeb558d952696$export$7da560f849543dff(_ref) {
@@ -645,48 +701,51 @@ function $e3efeb558d952696$export$7da560f849543dff(_ref) {
645
701
  const $b432b11321ad4c97$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<button class="show-more major" type="button"></button>`, 2),
646
702
  $b432b11321ad4c97$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class="depict plp recommendations"></div>`, 2);
647
703
  function $b432b11321ad4c97$export$9756467d34d91cdb(props) {
648
- const rows_object_ = $8tj43$createMemo(() => {
649
- const view_more_button = props.view_more_button;
650
- if (!view_more_button) return "all";
651
- return {
652
- start_rows: view_more_button.start_rows,
653
- rows_per_click: view_more_button.rows_per_click,
654
- button: (() => {
655
- const _el$ = $8tj43$getNextElement($b432b11321ad4c97$var$_tmpl$);
656
- $8tj43$insert(_el$, () => view_more_button.text);
657
- return _el$;
658
- })()
659
- };
660
- });
661
- const grid_spacing_override = $8tj43$createMemo(() => {
662
- const {
663
- grid_spacing: grid_spacing
664
- } = props; // can be reactive
665
- return typeof grid_spacing === "string" ? {
666
- grid_spacing: grid_spacing
667
- } : {
668
- override_vertical_spacing: grid_spacing.vertical,
669
- grid_spacing: grid_spacing.horizontal
670
- };
671
- });
672
- const [recommendations_resource_] = $8tj43$createResource(() => props.recommendations, recs => recs);
673
- return (() => {
674
- const _el$2 = $8tj43$getNextElement($b432b11321ad4c97$var$_tmpl$2);
675
- $8tj43$insert(_el$2, () => $e3efeb558d952696$export$7da560f849543dff({
676
- rows_object_: rows_object_,
677
- product_card_template_: function () {
678
- return props.product_card_template(...arguments);
679
- },
680
- recommendations_resource_: recommendations_resource_,
681
- market_: () => props.market,
682
- merchant_: () => props.merchant,
683
- layout_options_: $8tj43$createMemo(() => ({
684
- cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77($3f7203368ad0d3ca$export$ff7109b9b2b206ba(props.cols_at_size)),
685
- ...grid_spacing_override()
686
- }))
687
- }));
688
- return _el$2;
689
- })();
704
+ return $83e8cf2c0b87a58a$export$23fca46f3143581f(() => {
705
+ const rows_object_ = $8tj43$createMemo(() => {
706
+ var _view_more_button$row;
707
+ const view_more_button = props.view_more_button;
708
+ if (!view_more_button) return "all";
709
+ return {
710
+ start_rows: view_more_button.start_rows,
711
+ rows_per_click: (_view_more_button$row = view_more_button.rows_per_click) !== null && _view_more_button$row !== void 0 ? _view_more_button$row : 2,
712
+ button: (() => {
713
+ const _el$ = $8tj43$getNextElement($b432b11321ad4c97$var$_tmpl$);
714
+ $8tj43$insert(_el$, () => view_more_button.text);
715
+ return _el$;
716
+ })()
717
+ };
718
+ });
719
+ const grid_spacing_override = $8tj43$createMemo(() => {
720
+ const {
721
+ grid_spacing: grid_spacing
722
+ } = props; // can be reactive
723
+ return typeof grid_spacing === "string" ? {
724
+ grid_spacing: grid_spacing
725
+ } : {
726
+ override_vertical_spacing: grid_spacing.vertical,
727
+ grid_spacing: grid_spacing.horizontal
728
+ };
729
+ });
730
+ const [recommendations_resource_] = $8tj43$createResource(() => props.recommendations, recs => recs);
731
+ return (() => {
732
+ const _el$2 = $8tj43$getNextElement($b432b11321ad4c97$var$_tmpl$2);
733
+ $8tj43$insert(_el$2, () => $e3efeb558d952696$export$7da560f849543dff({
734
+ rows_object_: rows_object_,
735
+ product_card_template_: function () {
736
+ return props.product_card_template(...arguments);
737
+ },
738
+ recommendations_resource_: recommendations_resource_,
739
+ market_: () => props.market,
740
+ merchant_: () => props.merchant,
741
+ layout_options_: $8tj43$createMemo(() => ({
742
+ cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77($3f7203368ad0d3ca$export$ff7109b9b2b206ba(props.cols_at_size)),
743
+ ...grid_spacing_override()
744
+ }))
745
+ }));
746
+ return _el$2;
747
+ })();
748
+ }, "RecommendationGrid failed");
690
749
  }
691
750
  const $56047603f9d212b6$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<img>`, 1);
692
751
  function $56047603f9d212b6$export$e6fffe67d4cdd848(whatToWatch) {
@@ -1377,7 +1436,7 @@ const $6b73914551534ea8$export$48513f6b9f8ce62d = props => {
1377
1436
  const label = $8tj43$createMemo(() => props.label_);
1378
1437
  const checked = $8tj43$createMemo(() => props.checked_);
1379
1438
  const value = $8tj43$createMemo(() => props.value_);
1380
- const is_count_zero = $8tj43$createMemo(() => props.is_count_zero_);
1439
+ const is_count_zero = $8tj43$createMemo(() => props.is_count_zero_ || count() === 0);
1381
1440
  const id = $8tj43$make_random_classname();
1382
1441
  return (/* We can't use actual margin because ExpandingContainer gets messed up */(() => {
1383
1442
  const _el$ = $8tj43$getNextElement($6b73914551534ea8$var$_tmpl$2),
@@ -1417,14 +1476,17 @@ const $6b73914551534ea8$export$48513f6b9f8ce62d = props => {
1417
1476
  }
1418
1477
  }), _el$8, _co$);
1419
1478
  $8tj43$effect(_p$ => {
1420
- const _v$ = !!(is_count_zero() || count() === 0),
1421
- _v$2 = value();
1479
+ const _v$ = !!is_count_zero(),
1480
+ _v$2 = value(),
1481
+ _v$3 = !checked() && is_count_zero();
1422
1482
  _v$ !== _p$._v$ && _el$.classList.toggle("count-0", _p$._v$ = _v$);
1423
1483
  _v$2 !== _p$._v$2 && $8tj43$setAttribute(_el$3, "name", _p$._v$2 = _v$2);
1484
+ _v$3 !== _p$._v$3 && (_el$3.disabled = _p$._v$3 = _v$3);
1424
1485
  return _p$;
1425
1486
  }, {
1426
1487
  _v$: undefined,
1427
- _v$2: undefined
1488
+ _v$2: undefined,
1489
+ _v$3: undefined
1428
1490
  });
1429
1491
  $8tj43$effect(() => _el$3.checked = checked());
1430
1492
  return _el$;
@@ -2327,6 +2389,10 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
2327
2389
  });
2328
2390
  }
2329
2391
  }), _el$16, _co$5);
2392
+ $8tj43$effect(() => {
2393
+ var _value12;
2394
+ return _el$14.classList.toggle("count-0", !!(((_value12 = value()) === null || _value12 === void 0 ? void 0 : _value12.count_) === 0));
2395
+ });
2330
2396
  return _el$12;
2331
2397
  })();
2332
2398
  },
@@ -2347,8 +2413,8 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
2347
2413
  },
2348
2414
  get children() {
2349
2415
  return $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => {
2350
- var _value12;
2351
- return ((_value12 = value()) === null || _value12 === void 0 ? void 0 : _value12.children_) || {};
2416
+ var _value13;
2417
+ return ((_value13 = value()) === null || _value13 === void 0 ? void 0 : _value13.children_) || {};
2352
2418
  }), existing_filter, i18n_);
2353
2419
  }
2354
2420
  });
@@ -2535,7 +2601,8 @@ function $0ae614c5c7babb43$var$expand_until_choice(data_structure) {
2535
2601
  });
2536
2602
  }
2537
2603
  const $830ea8efda59884e$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="checkbox-grid"></div>`, 2),
2538
- $830ea8efda59884e$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<button class="major-minor-transition"></button>`, 2);
2604
+ $830ea8efda59884e$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<span class="count-wrapper"><span class="count"></span></span>`, 4),
2605
+ $830ea8efda59884e$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<button class="major-minor-transition"><!#><!/><!#><!/></button>`, 6);
2539
2606
  const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
2540
2607
  let {
2541
2608
  filter_: filter_,
@@ -2577,7 +2644,11 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
2577
2644
  return (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : (_existing_filter$data = _existing_filter.data) === null || _existing_filter$data === void 0 ? void 0 : _existing_filter$data.includes(value().value_);
2578
2645
  });
2579
2646
  return (() => {
2580
- const _el$2 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$2);
2647
+ const _el$2 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$3),
2648
+ _el$5 = _el$2.firstChild,
2649
+ [_el$6, _co$] = $8tj43$getNextMarker(_el$5.nextSibling),
2650
+ _el$7 = _el$6.nextSibling,
2651
+ [_el$8, _co$2] = $8tj43$getNextMarker(_el$7.nextSibling);
2581
2652
  $8tj43$addEventListener(_el$2, "click", $8tj43$catchify(() => {
2582
2653
  const set_filter = existing_filter();
2583
2654
  const {
@@ -2598,16 +2669,30 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
2598
2669
  const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
2599
2670
  set_selected_filters(selected_filters);
2600
2671
  }), true);
2601
- $8tj43$insert(_el$2, () => value().value_);
2672
+ $8tj43$insert(_el$2, () => value().value_, _el$6, _co$);
2673
+ $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
2674
+ get when() {
2675
+ return value().count_ != undefined;
2676
+ },
2677
+ get children() {
2678
+ const _el$3 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$2),
2679
+ _el$4 = _el$3.firstChild;
2680
+ $8tj43$insert(_el$4, () => value().count_);
2681
+ return _el$3;
2682
+ }
2683
+ }), _el$8, _co$2);
2602
2684
  $8tj43$effect(_p$ => {
2603
- const _v$ = !is_selected(),
2604
- _v$2 = !!is_selected();
2605
- _v$ !== _p$._v$ && _el$2.classList.toggle("minor", _p$._v$ = _v$);
2606
- _v$2 !== _p$._v$2 && _el$2.classList.toggle("major", _p$._v$2 = _v$2);
2685
+ const _v$ = value().count_ === 0 && !is_selected(),
2686
+ _v$2 = !is_selected(),
2687
+ _v$3 = !!is_selected();
2688
+ _v$ !== _p$._v$ && (_el$2.disabled = _p$._v$ = _v$);
2689
+ _v$2 !== _p$._v$2 && _el$2.classList.toggle("minor", _p$._v$2 = _v$2);
2690
+ _v$3 !== _p$._v$3 && _el$2.classList.toggle("major", _p$._v$3 = _v$3);
2607
2691
  return _p$;
2608
2692
  }, {
2609
2693
  _v$: undefined,
2610
- _v$2: undefined
2694
+ _v$2: undefined,
2695
+ _v$3: undefined
2611
2696
  });
2612
2697
  $8tj43$runHydrationEvents();
2613
2698
  return _el$2;
@@ -6742,35 +6827,6 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
6742
6827
  return _el$13;
6743
6828
  })()];
6744
6829
  }
6745
- function $83e8cf2c0b87a58a$export$23fca46f3143581f(component, error_message) {
6746
- const component_in_error_boundary = do_with_elements => {
6747
- const error_boundary_wrapped = $74777e8fe65b3dcb$export$b69d0d92862de18b({
6748
- severity_: "error",
6749
- message_: error_message,
6750
- get children() {
6751
- const elements = component();
6752
- do_with_elements === null || do_with_elements === void 0 || do_with_elements(elements);
6753
- return elements;
6754
- }
6755
- });
6756
- // This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
6757
- if (typeof error_boundary_wrapped === "function")
6758
- // @ts-ignore
6759
- return error_boundary_wrapped();
6760
- // On the server it returns a string, so we just return that
6761
- return error_boundary_wrapped;
6762
- };
6763
- const owner = $8tj43$getOwner();
6764
- if (owner == null) return $8tj43$createRoot(dispose => {
6765
- // 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
6766
- return component_in_error_boundary(elements => {
6767
- if (!(elements !== null && elements !== void 0 && elements.length)) return;
6768
- (0, $8tj43$observer).onremoved(elements[0], dispose);
6769
- });
6770
- });else
6771
- // we're already in a root so cleanups are handled
6772
- return component_in_error_boundary();
6773
- }
6774
6830
  function $9d3d794b62318ecc$export$477caf01aecaeb2a(options) {
6775
6831
  var _globalThis$location$, _globalThis$location;
6776
6832
  const router_ = options.router_;
@@ -8565,7 +8621,7 @@ function $3c5e15c6ee4227a9$export$605674723bcc715c() {
8565
8621
  const $40dd3f46f55d62ba$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<a class="suggestion"></a>`, 2),
8566
8622
  $40dd3f46f55d62ba$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class="search-icon"></div>`, 2),
8567
8623
  $40dd3f46f55d62ba$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<span class="type"></span>`, 2),
8568
- $40dd3f46f55d62ba$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div><!#><!/><span class="value"></span></div>`, 6),
8624
+ $40dd3f46f55d62ba$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class="with-parent-title"><!#><!/><span class="value line-clamp"></span></div>`, 6),
8569
8625
  $40dd3f46f55d62ba$var$_tmpl$5 = /*#__PURE__*/$8tj43$template(`<div class="with-icon"><!#><!/><!#><!/></div>`, 6),
8570
8626
  $40dd3f46f55d62ba$var$_tmpl$6 = /*#__PURE__*/$8tj43$template(`<h2 class="text"></h2>`, 2),
8571
8627
  $40dd3f46f55d62ba$var$_tmpl$7 = /*#__PURE__*/$8tj43$template(`<div class="suggestion-container query"><!#><!/><!#><!/></div>`, 6),
@@ -9959,7 +10015,9 @@ function $22470de5f42cc35d$export$f631859cab12b342(_ref) {
9959
10015
  function $881e8953a9103f10$export$9ff751cd77687edc(_ref) {
9960
10016
  let {
9961
10017
  search_results_: search_results_,
9962
- router_: router_
10018
+ router_: router_,
10019
+ queries_without_content_results_: queries_without_content_results_,
10020
+ get_search_query_: get_search_query_
9963
10021
  } = _ref;
9964
10022
  const content_results = $8tj43$createMemo(() => {
9965
10023
  var _search_results_;
@@ -9975,6 +10033,10 @@ function $881e8953a9103f10$export$9ff751cd77687edc(_ref) {
9975
10033
  }
9976
10034
  return map;
9977
10035
  });
10036
+ $8tj43$createEffect(() => {
10037
+ const results = content_results();
10038
+ if (Array.isArray(results) && results.length === 0) queries_without_content_results_.add($8tj43$untrack(get_search_query_));
10039
+ });
9978
10040
  return $8tj43$createComponent((0, $8tj43$For), {
9979
10041
  get each() {
9980
10042
  return [...content_results_by_page_url().keys()];
@@ -10041,8 +10103,15 @@ function $d53ebed6f63304e4$export$6d0c9c22f6652669(_ref) {
10041
10103
  number_: num_results,
10042
10104
  i18n_: i18n_
10043
10105
  });
10044
- const [is_showing_placeholders, set_is_showing_placeholders] = $8tj43$createSignal(false);
10106
+ const queries_without_content_results_ = new (0, $8tj43$ListenableSet)();
10107
+ const [check_query, set_check_query] = $8tj43$createSignal(false);
10108
+ const placeholders_enabled = $8tj43$createMemo(() => {
10109
+ // don't show placeholders when the user toggles filters
10110
+ check_query();
10111
+ return !queries_without_content_results_.has(get_search_query_());
10112
+ });
10045
10113
  const rows_object = $d53ebed6f63304e4$var$make_state_saved_rows(content_results_rows_, i18n_);
10114
+ for (const ev of ["add", "delete"]) queries_without_content_results_.addEventListener(ev, () => set_check_query(prev => !prev));
10046
10115
  return (() => {
10047
10116
  const _el$ = $8tj43$getNextElement($d53ebed6f63304e4$var$_tmpl$),
10048
10117
  _el$2 = _el$.firstChild,
@@ -10068,36 +10137,27 @@ function $d53ebed6f63304e4$export$6d0c9c22f6652669(_ref) {
10068
10137
  get children() {
10069
10138
  return $8tj43$createComponent((0, $8tj43$Suspense), {
10070
10139
  get fallback() {
10071
- return (() => {
10072
- set_is_showing_placeholders(true);
10073
- $8tj43$onCleanup(() => set_is_showing_placeholders(false));
10074
- return $8tj43$createComponent((0, $ad4f3c9872fbeb48$export$4405d077f0a20494), {
10075
- content_results_rows_: content_results_rows_,
10076
- get cols_at_size_() {
10077
- return $8tj43$createMemo(() => layout_options_().cols_at_size);
10078
- }
10079
- });
10080
- })();
10140
+ return $8tj43$createComponent((0, $ad4f3c9872fbeb48$export$4405d077f0a20494), {
10141
+ content_results_rows_: content_results_rows_,
10142
+ get cols_at_size_() {
10143
+ return $8tj43$createMemo(() => layout_options_().cols_at_size);
10144
+ }
10145
+ });
10081
10146
  },
10082
10147
  get children() {
10083
10148
  return $8tj43$createComponent((0, $881e8953a9103f10$export$9ff751cd77687edc), {
10084
10149
  router_: router_,
10085
- search_results_: search_results_
10150
+ search_results_: search_results_,
10151
+ queries_without_content_results_: queries_without_content_results_,
10152
+ get_search_query_: get_search_query_
10086
10153
  });
10087
10154
  }
10088
10155
  });
10089
10156
  }
10090
10157
  })), _el$5, _co$2);
10091
- $8tj43$effect(_p$ => {
10158
+ $8tj43$effect(() => {
10092
10159
  var _content_results2;
10093
- const _v$ = !!is_showing_placeholders(),
10094
- _v$2 = is_loading_() || ((_content_results2 = content_results()) === null || _content_results2 === void 0 ? void 0 : _content_results2.length) > 0 ? "" : "none";
10095
- _v$ !== _p$._v$ && _el$.classList.toggle("loading", _p$._v$ = _v$);
10096
- _v$2 !== _p$._v$2 && _el$.style.setProperty("display", _p$._v$2 = _v$2);
10097
- return _p$;
10098
- }, {
10099
- _v$: undefined,
10100
- _v$2: undefined
10160
+ return _el$.style.setProperty("display", is_loading_() && placeholders_enabled() || ((_content_results2 = content_results()) === null || _content_results2 === void 0 ? void 0 : _content_results2.length) > 0 ? "" : "none");
10101
10161
  });
10102
10162
  return _el$;
10103
10163
  })();
@@ -10586,7 +10646,7 @@ function $eb064bc3350276c1$var$_classApplyDescriptorGet(receiver, descriptor) {
10586
10646
  * 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.
10587
10647
  */
10588
10648
  const $eb064bc3350276c1$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
10589
- const $eb064bc3350276c1$var$content_search_default = false;
10649
+ const $eb064bc3350276c1$var$content_search_default = true;
10590
10650
  const $eb064bc3350276c1$var$min_products_to_fetch_ = 20;
10591
10651
  const $eb064bc3350276c1$export$bde3eb976dfded9 = depict_search => {
10592
10652
  var _privately_shared_pro;