@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.js CHANGED
@@ -1,6 +1,6 @@
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, 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";
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";
4
4
  import $8tj43$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
5
5
  import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
6
6
  import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
@@ -8,7 +8,7 @@ import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
8
8
  /*! Depict.ai search and product listing SDK */
9
9
  import { register_es_version } from "../multi_import_deduplicator.mjs";
10
10
  register_es_version("ui", "ES10");
11
- const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.25";
11
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0.0";
12
12
  const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
13
13
  const cols_at_size = [];
14
14
  for (let i = 0; i < sorted_cols_at_size.length; i++) {
@@ -82,7 +82,9 @@ function $3f7203368ad0d3ca$export$ff7109b9b2b206ba(sdk_cols_at_size) {
82
82
  }
83
83
  function $ca55612a53dbbdd2$export$a2cc176055f8f08() {
84
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.";
85
- return (0, $8tj43$isServer) ? "<!-- ".concat(text, " -->") : document.createComment(text);
85
+ return (0, $8tj43$isServer) ? {
86
+ t: "<!-- ".concat(text, " -->")
87
+ } : document.createComment(text);
86
88
  }
87
89
  function $cb64b315b25cfc59$export$2f0cbfbb4354bb52(elements) {
88
90
  // FYI this probably doesn't work on hugely deep nestings or large amount of elements
@@ -308,9 +310,14 @@ function $74777e8fe65b3dcb$export$b69d0d92862de18b(props) {
308
310
  const $63f1f8dbcd07d3b0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div></div>`, 2),
309
311
  $63f1f8dbcd07d3b0$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<style type="text/css"></style>`, 2);
310
312
  function $63f1f8dbcd07d3b0$export$d21e32dfedac04be(props) {
313
+ const container_class = "x" + $8tj43$createUniqueId();
311
314
  const container_element_ = (() => {
312
315
  const _el$ = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
313
- $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);
314
321
  $8tj43$insert(_el$, () => props.children);
315
322
  $8tj43$runHydrationEvents();
316
323
  return _el$;
@@ -321,12 +328,18 @@ function $63f1f8dbcd07d3b0$export$d21e32dfedac04be(props) {
321
328
  },
322
329
  severity_: "error",
323
330
  get children() {
324
- return $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element_);
331
+ return $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element_, false, container_class);
325
332
  }
326
333
  });
327
334
  }
328
335
  function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
329
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
+ }
330
343
  // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
331
344
  const show_all_rows = $8tj43$createMemo(() => props.rows === "all");
332
345
  const rows_or_empty_object = $8tj43$createMemo(() => show_all_rows() ? {} : props.rows);
@@ -341,10 +354,9 @@ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
341
354
  return !(!button || Array.isArray(button) && !button.length);
342
355
  });
343
356
  const [get_styling, set_styling] = $8tj43$createSignal();
344
- const container_class = $8tj43$make_random_classname();
345
357
  const selector_beginning = ".depict .".concat(container_class, ">"); // class so ppl can have id if needed
346
358
  const [get_children_count, set_children_count] = $8tj43$createSignal(0);
347
- 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);
348
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));
349
361
  const default_currently_visible_signal = $8tj43$createSignal($8tj43$untrack(() => {
350
362
  var _rows_or_empty_object;
@@ -353,43 +365,39 @@ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
353
365
  const rows_visible_signal = $8tj43$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
354
366
  const get_rows_visible = $8tj43$createMemo(() => rows_visible_signal()[0]());
355
367
  const set_rows_visible = $8tj43$createMemo(() => rows_visible_signal()[1]);
356
- const view_more_button_class = $8tj43$make_random_classname();
357
- const view_less_button_class = $8tj43$make_random_classname();
358
- const style_element = (() => {
359
- const _el$2 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$2);
360
- $8tj43$insert(_el$2, get_styling);
361
- return _el$2;
362
- })();
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
363
370
  const view_more_button_container = $8tj43$createMemo(() => have_a_view_more_button() && (() => {
364
- const _el$3 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
365
- $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 => {
366
373
  var _rows_or_empty_object2;
367
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);
368
375
  })), true);
369
- $8tj43$className(_el$3, "load-more-container ".concat(view_more_button_class));
370
- $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);
371
378
  $8tj43$runHydrationEvents();
372
- return _el$3;
379
+ return _el$2;
373
380
  })());
374
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
375
382
  const view_less_button_container = $8tj43$createMemo(() => have_a_view_less_button() && (() => {
376
- const _el$4 = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
377
- $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()(() => {
378
385
  var _rows_or_empty_object3;
379
386
  return (_rows_or_empty_object3 = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object3 !== void 0 ? _rows_or_empty_object3 : 1;
380
387
  })), true);
381
- $8tj43$className(_el$4, "load-less-container ".concat(view_less_button_class));
382
- $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);
383
390
  $8tj43$runHydrationEvents();
384
- return _el$4;
391
+ return _el$3;
385
392
  })());
386
- container_element.classList.add(container_class);
393
+ const [force_style_update, set_force_style_update] = $8tj43$createSignal("");
387
394
  $8tj43$createComputed(() => {
388
395
  // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
389
396
  const rows_visible = get_rows_visible();
390
397
  const max_rows = rows_or_empty_object().max_rows;
391
398
  if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
392
399
  });
400
+ $8tj43$createEffect(() => set_force_style_update(" ")); // force style update after hydration due to https://discord.com/channels/722131463138705510/722167424186843267/1151544212517552168
393
401
  $8tj43$createRenderEffect(() => {
394
402
  // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
395
403
  if (show_all_rows()) {
@@ -398,11 +406,13 @@ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
398
406
  return;
399
407
  }
400
408
  update_children_count();
401
- const mutation_observer = new MutationObserver($8tj43$catchify(update_children_count));
402
- mutation_observer.observe(container_element, {
403
- childList: true
404
- });
405
- $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
+ }
406
416
  set_styling(
407
417
  // this is needed because solid will think that the memo-accessor is a setter function otherwise
408
418
  () => $8tj43$createMemo(() => {
@@ -413,7 +423,7 @@ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
413
423
  } = rows_or_empty_object();
414
424
  const rows_visible = get_rows_visible();
415
425
  const children_count = get_children_count();
416
- return col_styling() + props.cols_at_size.map(options => {
426
+ return force_style_update() + col_styling() + props.cols_at_size.map(options => {
417
427
  const [recs_per_row, min, max] = options;
418
428
  let should_hide_view_more_button;
419
429
  let visible_recs;
@@ -434,6 +444,11 @@ function $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, container_element) {
434
444
  }).join("");
435
445
  }));
436
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
437
452
  if (insert_after_container) container_element.after(style_element);
438
453
  return [container_element, $8tj43$memo(view_more_button_container), $8tj43$memo(view_less_button_container), style_element];
439
454
  }
@@ -464,18 +479,26 @@ function $002f09d00aac50b2$export$6649caad96ef8870(_ref) {
464
479
  slider_ref_: slider_ref_,
465
480
  faded_opacity_ = 0.7,
466
481
  mutation_plugins_ = [],
467
- disable_fading_: disable_fading_
482
+ disable_fading_: disable_fading_,
483
+ arrow_width_: arrow_width_,
484
+ arrow_height_: arrow_height_
468
485
  } = _ref;
469
486
  const slider = new (0, $8tj43$Amazing_Slider)({
470
487
  button_contents: {
471
488
  left: [(() => {
472
489
  const _el$ = $8tj43$getNextElement($002f09d00aac50b2$var$_tmpl$);
473
- $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
+ }));
474
494
  return _el$;
475
495
  })()],
476
496
  right: [(() => {
477
497
  const _el$2 = $8tj43$getNextElement($002f09d00aac50b2$var$_tmpl$);
478
- $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
+ }));
479
502
  return _el$2;
480
503
  })()]
481
504
  },
@@ -504,6 +527,8 @@ function $39ddb986053fb759$export$d41d19e89346fa2(_ref) {
504
527
  });
505
528
  const num_placeholders_ = () => 20;
506
529
  const slider = $8tj43$createComponent((0, $002f09d00aac50b2$export$6649caad96ef8870), {
530
+ arrow_height_: 25,
531
+ arrow_width_: 12.5,
507
532
  disable_fading_: true,
508
533
  slider_ref_: slider => {
509
534
  const {
@@ -548,36 +573,68 @@ function $39ddb986053fb759$export$d41d19e89346fa2(_ref) {
548
573
  children: slider
549
574
  });
550
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
+ }
551
606
  const $d5d7e58c5c9d8db0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="depict recommendations"></div>`, 2);
552
607
  function $d5d7e58c5c9d8db0$export$9574e176201e5e8d(props) {
553
- const grid_spacing_override = $8tj43$createMemo(() => {
554
- const {
555
- grid_spacing: grid_spacing
556
- } = props; // can be reactive
557
- return typeof grid_spacing === "string" ? {
558
- grid_spacing: grid_spacing
559
- } : {
560
- override_vertical_spacing: grid_spacing.vertical,
561
- grid_spacing: grid_spacing.horizontal
562
- };
563
- });
564
- const [recommendations_resource_] = $8tj43$createResource(() => props.recommendations, recs => recs);
565
- return (() => {
566
- const _el$ = $8tj43$getNextElement($d5d7e58c5c9d8db0$var$_tmpl$);
567
- $8tj43$insert(_el$, () => $39ddb986053fb759$export$d41d19e89346fa2({
568
- product_card_template_: function () {
569
- return props.product_card_template(...arguments);
570
- },
571
- recommendations_resource_: recommendations_resource_,
572
- market_: () => props.market,
573
- merchant_: () => props.merchant,
574
- layout_options_: $8tj43$createMemo(() => ({
575
- cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77($3f7203368ad0d3ca$export$ff7109b9b2b206ba(props.cols_at_size)),
576
- ...grid_spacing_override()
577
- }))
578
- }));
579
- return _el$;
580
- })();
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");
581
638
  }
582
639
  const $e3efeb558d952696$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="recommendation-grid"><!#><!/><!#><!/></div>`, 6);
583
640
  function $e3efeb558d952696$export$7da560f849543dff(_ref) {
@@ -644,48 +701,51 @@ function $e3efeb558d952696$export$7da560f849543dff(_ref) {
644
701
  const $b432b11321ad4c97$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<button class="show-more major" type="button"></button>`, 2),
645
702
  $b432b11321ad4c97$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class="depict plp recommendations"></div>`, 2);
646
703
  function $b432b11321ad4c97$export$9756467d34d91cdb(props) {
647
- const rows_object_ = $8tj43$createMemo(() => {
648
- const view_more_button = props.view_more_button;
649
- if (!view_more_button) return "all";
650
- return {
651
- start_rows: view_more_button.start_rows,
652
- rows_per_click: view_more_button.rows_per_click,
653
- button: (() => {
654
- const _el$ = $8tj43$getNextElement($b432b11321ad4c97$var$_tmpl$);
655
- $8tj43$insert(_el$, () => view_more_button.text);
656
- return _el$;
657
- })()
658
- };
659
- });
660
- const grid_spacing_override = $8tj43$createMemo(() => {
661
- const {
662
- grid_spacing: grid_spacing
663
- } = props; // can be reactive
664
- return typeof grid_spacing === "string" ? {
665
- grid_spacing: grid_spacing
666
- } : {
667
- override_vertical_spacing: grid_spacing.vertical,
668
- grid_spacing: grid_spacing.horizontal
669
- };
670
- });
671
- const [recommendations_resource_] = $8tj43$createResource(() => props.recommendations, recs => recs);
672
- return (() => {
673
- const _el$2 = $8tj43$getNextElement($b432b11321ad4c97$var$_tmpl$2);
674
- $8tj43$insert(_el$2, () => $e3efeb558d952696$export$7da560f849543dff({
675
- rows_object_: rows_object_,
676
- product_card_template_: function () {
677
- return props.product_card_template(...arguments);
678
- },
679
- recommendations_resource_: recommendations_resource_,
680
- market_: () => props.market,
681
- merchant_: () => props.merchant,
682
- layout_options_: $8tj43$createMemo(() => ({
683
- cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77($3f7203368ad0d3ca$export$ff7109b9b2b206ba(props.cols_at_size)),
684
- ...grid_spacing_override()
685
- }))
686
- }));
687
- return _el$2;
688
- })();
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");
689
749
  }
690
750
  const $56047603f9d212b6$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<img>`, 1);
691
751
  function $56047603f9d212b6$export$e6fffe67d4cdd848(whatToWatch) {
@@ -1376,7 +1436,7 @@ const $6b73914551534ea8$export$48513f6b9f8ce62d = props => {
1376
1436
  const label = $8tj43$createMemo(() => props.label_);
1377
1437
  const checked = $8tj43$createMemo(() => props.checked_);
1378
1438
  const value = $8tj43$createMemo(() => props.value_);
1379
- const is_count_zero = $8tj43$createMemo(() => props.is_count_zero_);
1439
+ const is_count_zero = $8tj43$createMemo(() => props.is_count_zero_ || count() === 0);
1380
1440
  const id = $8tj43$make_random_classname();
1381
1441
  return (/* We can't use actual margin because ExpandingContainer gets messed up */(() => {
1382
1442
  const _el$ = $8tj43$getNextElement($6b73914551534ea8$var$_tmpl$2),
@@ -1416,14 +1476,17 @@ const $6b73914551534ea8$export$48513f6b9f8ce62d = props => {
1416
1476
  }
1417
1477
  }), _el$8, _co$);
1418
1478
  $8tj43$effect(_p$ => {
1419
- const _v$ = !!(is_count_zero() || count() === 0),
1420
- _v$2 = value();
1479
+ const _v$ = !!is_count_zero(),
1480
+ _v$2 = value(),
1481
+ _v$3 = !checked() && is_count_zero();
1421
1482
  _v$ !== _p$._v$ && _el$.classList.toggle("count-0", _p$._v$ = _v$);
1422
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);
1423
1485
  return _p$;
1424
1486
  }, {
1425
1487
  _v$: undefined,
1426
- _v$2: undefined
1488
+ _v$2: undefined,
1489
+ _v$3: undefined
1427
1490
  });
1428
1491
  $8tj43$effect(() => _el$3.checked = checked());
1429
1492
  return _el$;
@@ -2326,6 +2389,10 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
2326
2389
  });
2327
2390
  }
2328
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
+ });
2329
2396
  return _el$12;
2330
2397
  })();
2331
2398
  },
@@ -2346,8 +2413,8 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
2346
2413
  },
2347
2414
  get children() {
2348
2415
  return $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => {
2349
- var _value12;
2350
- 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_) || {};
2351
2418
  }), existing_filter, i18n_);
2352
2419
  }
2353
2420
  });
@@ -2534,7 +2601,8 @@ function $0ae614c5c7babb43$var$expand_until_choice(data_structure) {
2534
2601
  });
2535
2602
  }
2536
2603
  const $830ea8efda59884e$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="checkbox-grid"></div>`, 2),
2537
- $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);
2538
2606
  const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
2539
2607
  let {
2540
2608
  filter_: filter_,
@@ -2576,7 +2644,11 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
2576
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_);
2577
2645
  });
2578
2646
  return (() => {
2579
- 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);
2580
2652
  $8tj43$addEventListener(_el$2, "click", $8tj43$catchify(() => {
2581
2653
  const set_filter = existing_filter();
2582
2654
  const {
@@ -2597,16 +2669,30 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
2597
2669
  const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
2598
2670
  set_selected_filters(selected_filters);
2599
2671
  }), true);
2600
- $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);
2601
2684
  $8tj43$effect(_p$ => {
2602
- const _v$ = !is_selected(),
2603
- _v$2 = !!is_selected();
2604
- _v$ !== _p$._v$ && _el$2.classList.toggle("minor", _p$._v$ = _v$);
2605
- _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);
2606
2691
  return _p$;
2607
2692
  }, {
2608
2693
  _v$: undefined,
2609
- _v$2: undefined
2694
+ _v$2: undefined,
2695
+ _v$3: undefined
2610
2696
  });
2611
2697
  $8tj43$runHydrationEvents();
2612
2698
  return _el$2;
@@ -6741,35 +6827,6 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
6741
6827
  return _el$13;
6742
6828
  })()];
6743
6829
  }
6744
- function $83e8cf2c0b87a58a$export$23fca46f3143581f(component, error_message) {
6745
- const component_in_error_boundary = do_with_elements => {
6746
- const error_boundary_wrapped = $74777e8fe65b3dcb$export$b69d0d92862de18b({
6747
- severity_: "error",
6748
- message_: error_message,
6749
- get children() {
6750
- const elements = component();
6751
- do_with_elements === null || do_with_elements === void 0 || do_with_elements(elements);
6752
- return elements;
6753
- }
6754
- });
6755
- // This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
6756
- if (typeof error_boundary_wrapped === "function")
6757
- // @ts-ignore
6758
- return error_boundary_wrapped();
6759
- // On the server it returns a string, so we just return that
6760
- return error_boundary_wrapped;
6761
- };
6762
- const owner = $8tj43$getOwner();
6763
- if (owner == null) return $8tj43$createRoot(dispose => {
6764
- // 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
6765
- return component_in_error_boundary(elements => {
6766
- if (!(elements !== null && elements !== void 0 && elements.length)) return;
6767
- (0, $8tj43$observer).onremoved(elements[0], dispose);
6768
- });
6769
- });else
6770
- // we're already in a root so cleanups are handled
6771
- return component_in_error_boundary();
6772
- }
6773
6830
  function $9d3d794b62318ecc$export$477caf01aecaeb2a(options) {
6774
6831
  var _globalThis$location$, _globalThis$location;
6775
6832
  const router_ = options.router_;
@@ -8564,7 +8621,7 @@ function $3c5e15c6ee4227a9$export$605674723bcc715c() {
8564
8621
  const $40dd3f46f55d62ba$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<a class="suggestion"></a>`, 2),
8565
8622
  $40dd3f46f55d62ba$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class="search-icon"></div>`, 2),
8566
8623
  $40dd3f46f55d62ba$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<span class="type"></span>`, 2),
8567
- $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),
8568
8625
  $40dd3f46f55d62ba$var$_tmpl$5 = /*#__PURE__*/$8tj43$template(`<div class="with-icon"><!#><!/><!#><!/></div>`, 6),
8569
8626
  $40dd3f46f55d62ba$var$_tmpl$6 = /*#__PURE__*/$8tj43$template(`<h2 class="text"></h2>`, 2),
8570
8627
  $40dd3f46f55d62ba$var$_tmpl$7 = /*#__PURE__*/$8tj43$template(`<div class="suggestion-container query"><!#><!/><!#><!/></div>`, 6),
@@ -9958,7 +10015,9 @@ function $22470de5f42cc35d$export$f631859cab12b342(_ref) {
9958
10015
  function $881e8953a9103f10$export$9ff751cd77687edc(_ref) {
9959
10016
  let {
9960
10017
  search_results_: search_results_,
9961
- router_: router_
10018
+ router_: router_,
10019
+ queries_without_content_results_: queries_without_content_results_,
10020
+ get_search_query_: get_search_query_
9962
10021
  } = _ref;
9963
10022
  const content_results = $8tj43$createMemo(() => {
9964
10023
  var _search_results_;
@@ -9974,6 +10033,10 @@ function $881e8953a9103f10$export$9ff751cd77687edc(_ref) {
9974
10033
  }
9975
10034
  return map;
9976
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
+ });
9977
10040
  return $8tj43$createComponent((0, $8tj43$For), {
9978
10041
  get each() {
9979
10042
  return [...content_results_by_page_url().keys()];
@@ -10040,8 +10103,15 @@ function $d53ebed6f63304e4$export$6d0c9c22f6652669(_ref) {
10040
10103
  number_: num_results,
10041
10104
  i18n_: i18n_
10042
10105
  });
10043
- 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
+ });
10044
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));
10045
10115
  return (() => {
10046
10116
  const _el$ = $8tj43$getNextElement($d53ebed6f63304e4$var$_tmpl$),
10047
10117
  _el$2 = _el$.firstChild,
@@ -10067,36 +10137,27 @@ function $d53ebed6f63304e4$export$6d0c9c22f6652669(_ref) {
10067
10137
  get children() {
10068
10138
  return $8tj43$createComponent((0, $8tj43$Suspense), {
10069
10139
  get fallback() {
10070
- return (() => {
10071
- set_is_showing_placeholders(true);
10072
- $8tj43$onCleanup(() => set_is_showing_placeholders(false));
10073
- return $8tj43$createComponent((0, $ad4f3c9872fbeb48$export$4405d077f0a20494), {
10074
- content_results_rows_: content_results_rows_,
10075
- get cols_at_size_() {
10076
- return $8tj43$createMemo(() => layout_options_().cols_at_size);
10077
- }
10078
- });
10079
- })();
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
+ });
10080
10146
  },
10081
10147
  get children() {
10082
10148
  return $8tj43$createComponent((0, $881e8953a9103f10$export$9ff751cd77687edc), {
10083
10149
  router_: router_,
10084
- 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_
10085
10153
  });
10086
10154
  }
10087
10155
  });
10088
10156
  }
10089
10157
  })), _el$5, _co$2);
10090
- $8tj43$effect(_p$ => {
10158
+ $8tj43$effect(() => {
10091
10159
  var _content_results2;
10092
- const _v$ = !!is_showing_placeholders(),
10093
- _v$2 = is_loading_() || ((_content_results2 = content_results()) === null || _content_results2 === void 0 ? void 0 : _content_results2.length) > 0 ? "" : "none";
10094
- _v$ !== _p$._v$ && _el$.classList.toggle("loading", _p$._v$ = _v$);
10095
- _v$2 !== _p$._v$2 && _el$.style.setProperty("display", _p$._v$2 = _v$2);
10096
- return _p$;
10097
- }, {
10098
- _v$: undefined,
10099
- _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");
10100
10161
  });
10101
10162
  return _el$;
10102
10163
  })();
@@ -10585,7 +10646,7 @@ function $eb064bc3350276c1$var$_classApplyDescriptorGet(receiver, descriptor) {
10585
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.
10586
10647
  */
10587
10648
  const $eb064bc3350276c1$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
10588
- const $eb064bc3350276c1$var$content_search_default = false;
10649
+ const $eb064bc3350276c1$var$content_search_default = true;
10589
10650
  const $eb064bc3350276c1$var$min_products_to_fetch_ = 20;
10590
10651
  const $eb064bc3350276c1$export$bde3eb976dfded9 = depict_search => {
10591
10652
  var _privately_shared_pro;