@depict-ai/ui 4.0.0 → 4.0.1

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 CHANGED
@@ -92,7 +92,7 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447a
92
92
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
93
93
  $parcel$export(module.exports, "SearchField", () => $98aef9965764903d$export$316f6f283ae64765);
94
94
  /*! Depict.ai search and product listing SDK */
95
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.0";
95
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.1";
96
96
  function $a28000bc10de28ad$export$e417c49320921907(dependency, fetcher) {
97
97
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $52FdA$solidjs.createSignal();
98
98
  const deparallelizedFetcher = $52FdA$depictaiutilishared.deparallelize_no_drop(async dependencyValue => {
@@ -13479,11 +13479,22 @@ function $a60bc7692ce52705$export$44f738469d5570cf(_ref) {
13479
13479
  modalSearchFieldOuterWidth_: modalSearchFieldOuterWidth_
13480
13480
  } = _ref;
13481
13481
  return $52FdA$solidjs.createRoot(dispose => {
13482
+ const [innerWidthReactive, setInnerWidthReactive] = $52FdA$solidjs.createSignal(innerWidth);
13483
+ const resizeObserver = new ResizeObserver(records => setInnerWidthReactive(records.at(-1).contentRect.width));
13484
+ const {
13485
+ left: left,
13486
+ top: top,
13487
+ width: width
13488
+ } = actualField_.getBoundingClientRect();
13482
13489
  const fakeField = makeFakeField_();
13483
13490
  const owner = $52FdA$solidjs.getOwner();
13484
13491
  const inModalFieldWidth = $52FdA$solidjs.createMemo(
13485
13492
  // Can't have `min(${modalSearchFieldOuterWidth_()}px, var(--field-max-width, 600px))` because the WAAPI doesn't support that, so we need ot calculate it in JS
13486
- () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")) + "px");
13493
+ () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")));
13494
+ const inModalFieldWidthPx = $52FdA$solidjs.createMemo(() => inModalFieldWidth() + "px");
13495
+ let disableResizePollingTimeout;
13496
+ resizeObserver.observe(document.documentElement);
13497
+ $52FdA$solidjs.onCleanup(() => resizeObserver.disconnect());
13487
13498
  actualField_.replaceWith(fakeField);
13488
13499
  // Don't move the wrapped div since that would confuse run_in_root_or_auto_cleanup, but do actually move the field the user clicked around so that all selection stuff etc. is easier
13489
13500
  const addedToBody = wrap_ ? (() => {
@@ -13492,21 +13503,17 @@ function $a60bc7692ce52705$export$44f738469d5570cf(_ref) {
13492
13503
  return _el$;
13493
13504
  })() : actualField_;
13494
13505
  document.body.append(addedToBody);
13495
- const {
13496
- left: left,
13497
- top: top,
13498
- width: width
13499
- } = fakeField.getBoundingClientRect();
13500
13506
  const zIndexOfFake = getComputedStyle(fakeField).zIndex;
13501
13507
  Object.assign(addedToBody.style, {
13502
13508
  position: "fixed",
13503
13509
  top: top + "px",
13510
+ left: left + "px",
13504
13511
  width: width + "px",
13505
13512
  ...(zIndexOfFake !== "auto" ? {
13506
13513
  zIndex: +zIndexOfFake + 1
13507
13514
  } : {})
13508
13515
  });
13509
- const pxOffCenter = innerWidth / 2 - (left + width / 2);
13516
+ const pxOffCenter = $52FdA$solidjs.untrack(innerWidthReactive) / 2 - (left + width / 2);
13510
13517
  const openDuration = pxOffCenter > 100 ? 250 : 125; // faster animations if little left-right movement
13511
13518
  const closeDuration = pxOffCenter > 100 ? 150 : 100;
13512
13519
  setPollAlignment_(true);
@@ -13525,24 +13532,30 @@ function $a60bc7692ce52705$export$44f738469d5570cf(_ref) {
13525
13532
  // Wait until the ResizeObserver has delivered a value in case that the modal is small or has much padding so we know that we can't animate our fake field to be wider than that
13526
13533
  addedToBody.animate([{
13527
13534
  left: left + "px",
13528
- transform: "translateX(0%)",
13529
13535
  width: width + "px"
13530
13536
  }, {
13531
- left: "50%",
13532
- transform: "translateX(-50%)",
13533
- width: $52FdA$solidjs.untrack(inModalFieldWidth)
13537
+ left: "".concat($52FdA$solidjs.untrack(innerWidthReactive) / 2 - $52FdA$solidjs.untrack(inModalFieldWidth) / 2, "px"),
13538
+ width: $52FdA$solidjs.untrack(inModalFieldWidthPx)
13534
13539
  }], {
13535
13540
  duration: openDuration,
13536
13541
  easing: "ease-in"
13537
13542
  }).finished.then(() => {
13538
13543
  setPollAlignment_(false);
13539
- $52FdA$solidjs.runWithOwner(owner, () => $52FdA$solidjs.createEffect(() =>
13540
- // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
13541
- Object.assign(addedToBody.style, {
13542
- left: "50%",
13543
- transform: "translateX(-50%)",
13544
- width: inModalFieldWidth()
13545
- })));
13544
+ $52FdA$solidjs.runWithOwner(owner, () => $52FdA$solidjs.createEffect(() => {
13545
+ // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
13546
+ Object.assign(addedToBody.style, {
13547
+ // This is left: 50%, transform: translateX(-50) with extra steps but when using it safari and firefox glitch out like crazy
13548
+ left: "".concat(innerWidthReactive() / 2 - inModalFieldWidth() / 2, "px"),
13549
+ width: inModalFieldWidthPx()
13550
+ });
13551
+ // We might only have changed the left position which align_field doesn't know about, make it poll the position for a while
13552
+ setPollAlignment_(true);
13553
+ if (disableResizePollingTimeout) clearTimeout(disableResizePollingTimeout);
13554
+ disableResizePollingTimeout = setTimeout($52FdA$depictaiutilishared.catchify(() => {
13555
+ setPollAlignment_(false);
13556
+ disableResizePollingTimeout = undefined;
13557
+ }), 1000);
13558
+ }));
13546
13559
  });
13547
13560
  return true;
13548
13561
  }, false);
@@ -13585,13 +13598,11 @@ function $a60bc7692ce52705$export$44f738469d5570cf(_ref) {
13585
13598
  transition: "opacity ".concat(closeDuration, "ms ease-out")
13586
13599
  }));
13587
13600
  await Promise.all([addedToBody.animate([{
13588
- width: $52FdA$solidjs.untrack(inModalFieldWidth),
13589
- left: "50%",
13590
- transform: "translateX(-50%)"
13601
+ width: $52FdA$solidjs.untrack(inModalFieldWidthPx),
13602
+ left: "".concat($52FdA$solidjs.untrack(innerWidthReactive) / 2 - $52FdA$solidjs.untrack(inModalFieldWidth) / 2, "px")
13591
13603
  }, {
13592
13604
  width: width + "px",
13593
- left: left + "px",
13594
- transform: "translateX(0%)"
13605
+ left: left + "px"
13595
13606
  }], {
13596
13607
  duration: closeDuration,
13597
13608
  fill: "forwards",
package/ES10/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "4.0.0";
13
+ export const version = "4.0.1";
14
14
  export type ModalAlignmentSignals = {
15
15
  body_: Signal<JSX.CSSProperties>;
16
16
  field_: Signal<JSX.CSSProperties>;
@@ -642,7 +642,7 @@ export type BaseSearchProviderConfig<InputDisplay extends Display, PossibleTrans
642
642
  */
643
643
  enableContentSearch?: boolean;
644
644
  /**
645
- * The search modal component to use. You can switch between the classic and the new search modal. Provide one of the components here that you can import from the same package as the one you're using to see this message.
645
+ * The search modal component to use. You can switch between the classic and the new search modal. Provide one of the components here that you can import from the same package as the one you're using to see this message (`SearchModalV2` or `ClassicSearchModal`).
646
646
  * You also need to reflect the choice in SCSS, example:
647
647
  * ```scss
648
648
  * @use "@depict-ai/js-ui" as plp-styling with (
package/ES10/index.js CHANGED
@@ -10,7 +10,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "4.0.0";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.0.1";
14
14
  function $a604a8ffa4e4c03f$export$e417c49320921907(dependency, fetcher) {
15
15
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $8tj43$createSignal();
16
16
  const deparallelizedFetcher = $8tj43$deparallelize_no_drop(async dependencyValue => {
@@ -13397,11 +13397,22 @@ function $937791b86d3d1509$export$44f738469d5570cf(_ref) {
13397
13397
  modalSearchFieldOuterWidth_: modalSearchFieldOuterWidth_
13398
13398
  } = _ref;
13399
13399
  return $8tj43$createRoot(dispose => {
13400
+ const [innerWidthReactive, setInnerWidthReactive] = $8tj43$createSignal(innerWidth);
13401
+ const resizeObserver = new ResizeObserver(records => setInnerWidthReactive(records.at(-1).contentRect.width));
13402
+ const {
13403
+ left: left,
13404
+ top: top,
13405
+ width: width
13406
+ } = actualField_.getBoundingClientRect();
13400
13407
  const fakeField = makeFakeField_();
13401
13408
  const owner = $8tj43$getOwner();
13402
13409
  const inModalFieldWidth = $8tj43$createMemo(
13403
13410
  // Can't have `min(${modalSearchFieldOuterWidth_()}px, var(--field-max-width, 600px))` because the WAAPI doesn't support that, so we need ot calculate it in JS
13404
- () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")) + "px");
13411
+ () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")));
13412
+ const inModalFieldWidthPx = $8tj43$createMemo(() => inModalFieldWidth() + "px");
13413
+ let disableResizePollingTimeout;
13414
+ resizeObserver.observe(document.documentElement);
13415
+ $8tj43$onCleanup(() => resizeObserver.disconnect());
13405
13416
  actualField_.replaceWith(fakeField);
13406
13417
  // Don't move the wrapped div since that would confuse run_in_root_or_auto_cleanup, but do actually move the field the user clicked around so that all selection stuff etc. is easier
13407
13418
  const addedToBody = wrap_ ? (() => {
@@ -13410,21 +13421,17 @@ function $937791b86d3d1509$export$44f738469d5570cf(_ref) {
13410
13421
  return _el$;
13411
13422
  })() : actualField_;
13412
13423
  document.body.append(addedToBody);
13413
- const {
13414
- left: left,
13415
- top: top,
13416
- width: width
13417
- } = fakeField.getBoundingClientRect();
13418
13424
  const zIndexOfFake = getComputedStyle(fakeField).zIndex;
13419
13425
  Object.assign(addedToBody.style, {
13420
13426
  position: "fixed",
13421
13427
  top: top + "px",
13428
+ left: left + "px",
13422
13429
  width: width + "px",
13423
13430
  ...(zIndexOfFake !== "auto" ? {
13424
13431
  zIndex: +zIndexOfFake + 1
13425
13432
  } : {})
13426
13433
  });
13427
- const pxOffCenter = innerWidth / 2 - (left + width / 2);
13434
+ const pxOffCenter = $8tj43$untrack(innerWidthReactive) / 2 - (left + width / 2);
13428
13435
  const openDuration = pxOffCenter > 100 ? 250 : 125; // faster animations if little left-right movement
13429
13436
  const closeDuration = pxOffCenter > 100 ? 150 : 100;
13430
13437
  setPollAlignment_(true);
@@ -13443,24 +13450,30 @@ function $937791b86d3d1509$export$44f738469d5570cf(_ref) {
13443
13450
  // Wait until the ResizeObserver has delivered a value in case that the modal is small or has much padding so we know that we can't animate our fake field to be wider than that
13444
13451
  addedToBody.animate([{
13445
13452
  left: left + "px",
13446
- transform: "translateX(0%)",
13447
13453
  width: width + "px"
13448
13454
  }, {
13449
- left: "50%",
13450
- transform: "translateX(-50%)",
13451
- width: $8tj43$untrack(inModalFieldWidth)
13455
+ left: "".concat($8tj43$untrack(innerWidthReactive) / 2 - $8tj43$untrack(inModalFieldWidth) / 2, "px"),
13456
+ width: $8tj43$untrack(inModalFieldWidthPx)
13452
13457
  }], {
13453
13458
  duration: openDuration,
13454
13459
  easing: "ease-in"
13455
13460
  }).finished.then(() => {
13456
13461
  setPollAlignment_(false);
13457
- $8tj43$runWithOwner(owner, () => $8tj43$createEffect(() =>
13458
- // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
13459
- Object.assign(addedToBody.style, {
13460
- left: "50%",
13461
- transform: "translateX(-50%)",
13462
- width: inModalFieldWidth()
13463
- })));
13462
+ $8tj43$runWithOwner(owner, () => $8tj43$createEffect(() => {
13463
+ // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
13464
+ Object.assign(addedToBody.style, {
13465
+ // This is left: 50%, transform: translateX(-50) with extra steps but when using it safari and firefox glitch out like crazy
13466
+ left: "".concat(innerWidthReactive() / 2 - inModalFieldWidth() / 2, "px"),
13467
+ width: inModalFieldWidthPx()
13468
+ });
13469
+ // We might only have changed the left position which align_field doesn't know about, make it poll the position for a while
13470
+ setPollAlignment_(true);
13471
+ if (disableResizePollingTimeout) clearTimeout(disableResizePollingTimeout);
13472
+ disableResizePollingTimeout = setTimeout($8tj43$catchify(() => {
13473
+ setPollAlignment_(false);
13474
+ disableResizePollingTimeout = undefined;
13475
+ }), 1000);
13476
+ }));
13464
13477
  });
13465
13478
  return true;
13466
13479
  }, false);
@@ -13503,13 +13516,11 @@ function $937791b86d3d1509$export$44f738469d5570cf(_ref) {
13503
13516
  transition: "opacity ".concat(closeDuration, "ms ease-out")
13504
13517
  }));
13505
13518
  await Promise.all([addedToBody.animate([{
13506
- width: $8tj43$untrack(inModalFieldWidth),
13507
- left: "50%",
13508
- transform: "translateX(-50%)"
13519
+ width: $8tj43$untrack(inModalFieldWidthPx),
13520
+ left: "".concat($8tj43$untrack(innerWidthReactive) / 2 - $8tj43$untrack(inModalFieldWidth) / 2, "px")
13509
13521
  }, {
13510
13522
  width: width + "px",
13511
- left: left + "px",
13512
- transform: "translateX(0%)"
13523
+ left: left + "px"
13513
13524
  }], {
13514
13525
  duration: closeDuration,
13515
13526
  fill: "forwards",
package/latest/index.cjs CHANGED
@@ -86,7 +86,7 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad99
86
86
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
87
87
  $parcel$export(module.exports, "SearchField", () => $c0a0659cf97e8eb2$export$316f6f283ae64765);
88
88
  /*! Depict.ai search and product listing SDK */
89
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.0.0";
89
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.0.1";
90
90
  function $53df95e470b2f8d2$export$e417c49320921907(dependency, fetcher) {
91
91
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $gVhhF$solidjs.createSignal();
92
92
  const deparallelizedFetcher = $gVhhF$depictaiutilishared.deparallelize_no_drop(async dependencyValue => {
@@ -12658,11 +12658,22 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
12658
12658
  modalSearchFieldOuterWidth_: modalSearchFieldOuterWidth_
12659
12659
  }) {
12660
12660
  return $gVhhF$solidjs.createRoot(dispose => {
12661
+ const [innerWidthReactive, setInnerWidthReactive] = $gVhhF$solidjs.createSignal(innerWidth);
12662
+ const resizeObserver = new ResizeObserver(records => setInnerWidthReactive(records.at(-1).contentRect.width));
12663
+ const {
12664
+ left: left,
12665
+ top: top,
12666
+ width: width
12667
+ } = actualField_.getBoundingClientRect();
12661
12668
  const fakeField = makeFakeField_();
12662
12669
  const owner = $gVhhF$solidjs.getOwner();
12663
12670
  const inModalFieldWidth = $gVhhF$solidjs.createMemo(
12664
12671
  // Can't have `min(${modalSearchFieldOuterWidth_()}px, var(--field-max-width, 600px))` because the WAAPI doesn't support that, so we need ot calculate it in JS
12665
- () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")) + "px");
12672
+ () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")));
12673
+ const inModalFieldWidthPx = $gVhhF$solidjs.createMemo(() => inModalFieldWidth() + "px");
12674
+ let disableResizePollingTimeout;
12675
+ resizeObserver.observe(document.documentElement);
12676
+ $gVhhF$solidjs.onCleanup(() => resizeObserver.disconnect());
12666
12677
  actualField_.replaceWith(fakeField);
12667
12678
  // Don't move the wrapped div since that would confuse run_in_root_or_auto_cleanup, but do actually move the field the user clicked around so that all selection stuff etc. is easier
12668
12679
  const addedToBody = wrap_ ? (() => {
@@ -12671,21 +12682,17 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
12671
12682
  return _el$;
12672
12683
  })() : actualField_;
12673
12684
  document.body.append(addedToBody);
12674
- const {
12675
- left: left,
12676
- top: top,
12677
- width: width
12678
- } = fakeField.getBoundingClientRect();
12679
12685
  const zIndexOfFake = getComputedStyle(fakeField).zIndex;
12680
12686
  Object.assign(addedToBody.style, {
12681
12687
  position: "fixed",
12682
12688
  top: top + "px",
12689
+ left: left + "px",
12683
12690
  width: width + "px",
12684
12691
  ...(zIndexOfFake !== "auto" ? {
12685
12692
  zIndex: +zIndexOfFake + 1
12686
12693
  } : {})
12687
12694
  });
12688
- const pxOffCenter = innerWidth / 2 - (left + width / 2);
12695
+ const pxOffCenter = $gVhhF$solidjs.untrack(innerWidthReactive) / 2 - (left + width / 2);
12689
12696
  const openDuration = pxOffCenter > 100 ? 250 : 125; // faster animations if little left-right movement
12690
12697
  const closeDuration = pxOffCenter > 100 ? 150 : 100;
12691
12698
  setPollAlignment_(true);
@@ -12704,24 +12711,30 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
12704
12711
  // Wait until the ResizeObserver has delivered a value in case that the modal is small or has much padding so we know that we can't animate our fake field to be wider than that
12705
12712
  addedToBody.animate([{
12706
12713
  left: left + "px",
12707
- transform: "translateX(0%)",
12708
12714
  width: width + "px"
12709
12715
  }, {
12710
- left: "50%",
12711
- transform: "translateX(-50%)",
12712
- width: $gVhhF$solidjs.untrack(inModalFieldWidth)
12716
+ left: `${$gVhhF$solidjs.untrack(innerWidthReactive) / 2 - $gVhhF$solidjs.untrack(inModalFieldWidth) / 2}px`,
12717
+ width: $gVhhF$solidjs.untrack(inModalFieldWidthPx)
12713
12718
  }], {
12714
12719
  duration: openDuration,
12715
12720
  easing: "ease-in"
12716
12721
  }).finished.then(() => {
12717
12722
  setPollAlignment_(false);
12718
- $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() =>
12719
- // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
12720
- Object.assign(addedToBody.style, {
12721
- left: "50%",
12722
- transform: "translateX(-50%)",
12723
- width: inModalFieldWidth()
12724
- })));
12723
+ $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => {
12724
+ // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
12725
+ Object.assign(addedToBody.style, {
12726
+ // This is left: 50%, transform: translateX(-50) with extra steps but when using it safari and firefox glitch out like crazy
12727
+ left: `${innerWidthReactive() / 2 - inModalFieldWidth() / 2}px`,
12728
+ width: inModalFieldWidthPx()
12729
+ });
12730
+ // We might only have changed the left position which align_field doesn't know about, make it poll the position for a while
12731
+ setPollAlignment_(true);
12732
+ if (disableResizePollingTimeout) clearTimeout(disableResizePollingTimeout);
12733
+ disableResizePollingTimeout = setTimeout($gVhhF$depictaiutilishared.catchify(() => {
12734
+ setPollAlignment_(false);
12735
+ disableResizePollingTimeout = undefined;
12736
+ }), 1000);
12737
+ }));
12725
12738
  });
12726
12739
  return true;
12727
12740
  }, false);
@@ -12764,13 +12777,11 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
12764
12777
  transition: `opacity ${closeDuration}ms ease-out`
12765
12778
  }));
12766
12779
  await Promise.all([addedToBody.animate([{
12767
- width: $gVhhF$solidjs.untrack(inModalFieldWidth),
12768
- left: "50%",
12769
- transform: "translateX(-50%)"
12780
+ width: $gVhhF$solidjs.untrack(inModalFieldWidthPx),
12781
+ left: `${$gVhhF$solidjs.untrack(innerWidthReactive) / 2 - $gVhhF$solidjs.untrack(inModalFieldWidth) / 2}px`
12770
12782
  }, {
12771
12783
  width: width + "px",
12772
- left: left + "px",
12773
- transform: "translateX(0%)"
12784
+ left: left + "px"
12774
12785
  }], {
12775
12786
  duration: closeDuration,
12776
12787
  fill: "forwards",
package/latest/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "4.0.0";
13
+ export const version = "4.0.1";
14
14
  export type ModalAlignmentSignals = {
15
15
  body_: Signal<JSX.CSSProperties>;
16
16
  field_: Signal<JSX.CSSProperties>;
@@ -642,7 +642,7 @@ export type BaseSearchProviderConfig<InputDisplay extends Display, PossibleTrans
642
642
  */
643
643
  enableContentSearch?: boolean;
644
644
  /**
645
- * The search modal component to use. You can switch between the classic and the new search modal. Provide one of the components here that you can import from the same package as the one you're using to see this message.
645
+ * The search modal component to use. You can switch between the classic and the new search modal. Provide one of the components here that you can import from the same package as the one you're using to see this message (`SearchModalV2` or `ClassicSearchModal`).
646
646
  * You also need to reflect the choice in SCSS, example:
647
647
  * ```scss
648
648
  * @use "@depict-ai/js-ui" as plp-styling with (
package/latest/index.js CHANGED
@@ -7,7 +7,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "4.0.0";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.0.1";
11
11
  function $136f1d4d6c7ba6ac$export$e417c49320921907(dependency, fetcher) {
12
12
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $9HbP8$createSignal();
13
13
  const deparallelizedFetcher = $9HbP8$deparallelize_no_drop(async dependencyValue => {
@@ -12579,11 +12579,22 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
12579
12579
  modalSearchFieldOuterWidth_: modalSearchFieldOuterWidth_
12580
12580
  }) {
12581
12581
  return $9HbP8$createRoot(dispose => {
12582
+ const [innerWidthReactive, setInnerWidthReactive] = $9HbP8$createSignal(innerWidth);
12583
+ const resizeObserver = new ResizeObserver(records => setInnerWidthReactive(records.at(-1).contentRect.width));
12584
+ const {
12585
+ left: left,
12586
+ top: top,
12587
+ width: width
12588
+ } = actualField_.getBoundingClientRect();
12582
12589
  const fakeField = makeFakeField_();
12583
12590
  const owner = $9HbP8$getOwner();
12584
12591
  const inModalFieldWidth = $9HbP8$createMemo(
12585
12592
  // Can't have `min(${modalSearchFieldOuterWidth_()}px, var(--field-max-width, 600px))` because the WAAPI doesn't support that, so we need ot calculate it in JS
12586
- () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")) + "px");
12593
+ () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")));
12594
+ const inModalFieldWidthPx = $9HbP8$createMemo(() => inModalFieldWidth() + "px");
12595
+ let disableResizePollingTimeout;
12596
+ resizeObserver.observe(document.documentElement);
12597
+ $9HbP8$onCleanup(() => resizeObserver.disconnect());
12587
12598
  actualField_.replaceWith(fakeField);
12588
12599
  // Don't move the wrapped div since that would confuse run_in_root_or_auto_cleanup, but do actually move the field the user clicked around so that all selection stuff etc. is easier
12589
12600
  const addedToBody = wrap_ ? (() => {
@@ -12592,21 +12603,17 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
12592
12603
  return _el$;
12593
12604
  })() : actualField_;
12594
12605
  document.body.append(addedToBody);
12595
- const {
12596
- left: left,
12597
- top: top,
12598
- width: width
12599
- } = fakeField.getBoundingClientRect();
12600
12606
  const zIndexOfFake = getComputedStyle(fakeField).zIndex;
12601
12607
  Object.assign(addedToBody.style, {
12602
12608
  position: "fixed",
12603
12609
  top: top + "px",
12610
+ left: left + "px",
12604
12611
  width: width + "px",
12605
12612
  ...(zIndexOfFake !== "auto" ? {
12606
12613
  zIndex: +zIndexOfFake + 1
12607
12614
  } : {})
12608
12615
  });
12609
- const pxOffCenter = innerWidth / 2 - (left + width / 2);
12616
+ const pxOffCenter = $9HbP8$untrack(innerWidthReactive) / 2 - (left + width / 2);
12610
12617
  const openDuration = pxOffCenter > 100 ? 250 : 125; // faster animations if little left-right movement
12611
12618
  const closeDuration = pxOffCenter > 100 ? 150 : 100;
12612
12619
  setPollAlignment_(true);
@@ -12625,24 +12632,30 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
12625
12632
  // Wait until the ResizeObserver has delivered a value in case that the modal is small or has much padding so we know that we can't animate our fake field to be wider than that
12626
12633
  addedToBody.animate([{
12627
12634
  left: left + "px",
12628
- transform: "translateX(0%)",
12629
12635
  width: width + "px"
12630
12636
  }, {
12631
- left: "50%",
12632
- transform: "translateX(-50%)",
12633
- width: $9HbP8$untrack(inModalFieldWidth)
12637
+ left: `${$9HbP8$untrack(innerWidthReactive) / 2 - $9HbP8$untrack(inModalFieldWidth) / 2}px`,
12638
+ width: $9HbP8$untrack(inModalFieldWidthPx)
12634
12639
  }], {
12635
12640
  duration: openDuration,
12636
12641
  easing: "ease-in"
12637
12642
  }).finished.then(() => {
12638
12643
  setPollAlignment_(false);
12639
- $9HbP8$runWithOwner(owner, () => $9HbP8$createEffect(() =>
12640
- // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
12641
- Object.assign(addedToBody.style, {
12642
- left: "50%",
12643
- transform: "translateX(-50%)",
12644
- width: inModalFieldWidth()
12645
- })));
12644
+ $9HbP8$runWithOwner(owner, () => $9HbP8$createEffect(() => {
12645
+ // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
12646
+ Object.assign(addedToBody.style, {
12647
+ // This is left: 50%, transform: translateX(-50) with extra steps but when using it safari and firefox glitch out like crazy
12648
+ left: `${innerWidthReactive() / 2 - inModalFieldWidth() / 2}px`,
12649
+ width: inModalFieldWidthPx()
12650
+ });
12651
+ // We might only have changed the left position which align_field doesn't know about, make it poll the position for a while
12652
+ setPollAlignment_(true);
12653
+ if (disableResizePollingTimeout) clearTimeout(disableResizePollingTimeout);
12654
+ disableResizePollingTimeout = setTimeout($9HbP8$catchify(() => {
12655
+ setPollAlignment_(false);
12656
+ disableResizePollingTimeout = undefined;
12657
+ }), 1000);
12658
+ }));
12646
12659
  });
12647
12660
  return true;
12648
12661
  }, false);
@@ -12685,13 +12698,11 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
12685
12698
  transition: `opacity ${closeDuration}ms ease-out`
12686
12699
  }));
12687
12700
  await Promise.all([addedToBody.animate([{
12688
- width: $9HbP8$untrack(inModalFieldWidth),
12689
- left: "50%",
12690
- transform: "translateX(-50%)"
12701
+ width: $9HbP8$untrack(inModalFieldWidthPx),
12702
+ left: `${$9HbP8$untrack(innerWidthReactive) / 2 - $9HbP8$untrack(inModalFieldWidth) / 2}px`
12691
12703
  }, {
12692
12704
  width: width + "px",
12693
- left: left + "px",
12694
- transform: "translateX(0%)"
12705
+ left: left + "px"
12695
12706
  }], {
12696
12707
  duration: closeDuration,
12697
12708
  fill: "forwards",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
5
5
  "packageManager": "yarn@3.2.2",
6
6
  "sass": "styles.scss",
@@ -236,9 +236,9 @@
236
236
  "@babel/plugin-transform-typescript": "^7.22.9",
237
237
  "@babel/runtime": "latest",
238
238
  "@babel/runtime-corejs3": "^7.22.6",
239
- "@depict-ai/plp-styling": "^3.0.1",
239
+ "@depict-ai/plp-styling": "^3.0.3",
240
240
  "@depict-ai/types": "^5.0.3",
241
- "@depict-ai/utilishared": "^2.0.9",
241
+ "@depict-ai/utilishared": "^2.0.10",
242
242
  "solid-js": "^1.8.7"
243
243
  },
244
244
  "type": "module",
@@ -92,7 +92,7 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447a
92
92
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
93
93
  $parcel$export(module.exports, "SearchField", () => $98aef9965764903d$export$316f6f283ae64765);
94
94
  /*! Depict.ai search and product listing SDK */
95
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.0";
95
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.1";
96
96
  function $a28000bc10de28ad$export$e417c49320921907(dependency, fetcher) {
97
97
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $3hooq$solidjs.createSignal();
98
98
  const deparallelizedFetcher = $3hooq$depictaiutilishared.deparallelize_no_drop(async dependencyValue => {
@@ -11053,30 +11053,37 @@ function $a60bc7692ce52705$export$44f738469d5570cf(_ref) {
11053
11053
  modalSearchFieldOuterWidth_: modalSearchFieldOuterWidth_
11054
11054
  } = _ref;
11055
11055
  return $3hooq$solidjs.createRoot(dispose => {
11056
+ const [innerWidthReactive, setInnerWidthReactive] = $3hooq$solidjs.createSignal(innerWidth);
11057
+ const resizeObserver = new ResizeObserver(records => setInnerWidthReactive(records.at(-1).contentRect.width));
11058
+ const {
11059
+ left: left,
11060
+ top: top,
11061
+ width: width
11062
+ } = actualField_.getBoundingClientRect();
11056
11063
  const fakeField = makeFakeField_();
11057
11064
  const owner = $3hooq$solidjs.getOwner();
11058
11065
  const inModalFieldWidth = $3hooq$solidjs.createMemo(
11059
11066
  // Can't have `min(${modalSearchFieldOuterWidth_()}px, var(--field-max-width, 600px))` because the WAAPI doesn't support that, so we need ot calculate it in JS
11060
- () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")) + "px");
11067
+ () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")));
11068
+ const inModalFieldWidthPx = $3hooq$solidjs.createMemo(() => inModalFieldWidth() + "px");
11069
+ let disableResizePollingTimeout;
11070
+ resizeObserver.observe(document.documentElement);
11071
+ $3hooq$solidjs.onCleanup(() => resizeObserver.disconnect());
11061
11072
  actualField_.replaceWith(fakeField);
11062
11073
  // Don't move the wrapped div since that would confuse run_in_root_or_auto_cleanup, but do actually move the field the user clicked around so that all selection stuff etc. is easier
11063
11074
  const addedToBody = wrap_ ? $3hooq$solidjsweb.ssr($a60bc7692ce52705$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(actualField_)) : actualField_;
11064
11075
  document.body.append(addedToBody);
11065
- const {
11066
- left: left,
11067
- top: top,
11068
- width: width
11069
- } = fakeField.getBoundingClientRect();
11070
11076
  const zIndexOfFake = getComputedStyle(fakeField).zIndex;
11071
11077
  Object.assign(addedToBody.style, {
11072
11078
  position: "fixed",
11073
11079
  top: top + "px",
11080
+ left: left + "px",
11074
11081
  width: width + "px",
11075
11082
  ...(zIndexOfFake !== "auto" ? {
11076
11083
  zIndex: +zIndexOfFake + 1
11077
11084
  } : {})
11078
11085
  });
11079
- const pxOffCenter = innerWidth / 2 - (left + width / 2);
11086
+ const pxOffCenter = $3hooq$solidjs.untrack(innerWidthReactive) / 2 - (left + width / 2);
11080
11087
  const openDuration = pxOffCenter > 100 ? 250 : 125; // faster animations if little left-right movement
11081
11088
  const closeDuration = pxOffCenter > 100 ? 150 : 100;
11082
11089
  setPollAlignment_(true);
@@ -11095,24 +11102,30 @@ function $a60bc7692ce52705$export$44f738469d5570cf(_ref) {
11095
11102
  // Wait until the ResizeObserver has delivered a value in case that the modal is small or has much padding so we know that we can't animate our fake field to be wider than that
11096
11103
  addedToBody.animate([{
11097
11104
  left: left + "px",
11098
- transform: "translateX(0%)",
11099
11105
  width: width + "px"
11100
11106
  }, {
11101
- left: "50%",
11102
- transform: "translateX(-50%)",
11103
- width: $3hooq$solidjs.untrack(inModalFieldWidth)
11107
+ left: "".concat($3hooq$solidjs.untrack(innerWidthReactive) / 2 - $3hooq$solidjs.untrack(inModalFieldWidth) / 2, "px"),
11108
+ width: $3hooq$solidjs.untrack(inModalFieldWidthPx)
11104
11109
  }], {
11105
11110
  duration: openDuration,
11106
11111
  easing: "ease-in"
11107
11112
  }).finished.then(() => {
11108
11113
  setPollAlignment_(false);
11109
- $3hooq$solidjs.runWithOwner(owner, () => $3hooq$solidjs.createEffect(() =>
11110
- // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
11111
- Object.assign(addedToBody.style, {
11112
- left: "50%",
11113
- transform: "translateX(-50%)",
11114
- width: inModalFieldWidth()
11115
- })));
11114
+ $3hooq$solidjs.runWithOwner(owner, () => $3hooq$solidjs.createEffect(() => {
11115
+ // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
11116
+ Object.assign(addedToBody.style, {
11117
+ // This is left: 50%, transform: translateX(-50) with extra steps but when using it safari and firefox glitch out like crazy
11118
+ left: "".concat(innerWidthReactive() / 2 - inModalFieldWidth() / 2, "px"),
11119
+ width: inModalFieldWidthPx()
11120
+ });
11121
+ // We might only have changed the left position which align_field doesn't know about, make it poll the position for a while
11122
+ setPollAlignment_(true);
11123
+ if (disableResizePollingTimeout) clearTimeout(disableResizePollingTimeout);
11124
+ disableResizePollingTimeout = setTimeout($3hooq$depictaiutilishared.catchify(() => {
11125
+ setPollAlignment_(false);
11126
+ disableResizePollingTimeout = undefined;
11127
+ }), 1000);
11128
+ }));
11116
11129
  });
11117
11130
  return true;
11118
11131
  }, false);
@@ -11155,13 +11168,11 @@ function $a60bc7692ce52705$export$44f738469d5570cf(_ref) {
11155
11168
  transition: "opacity ".concat(closeDuration, "ms ease-out")
11156
11169
  }));
11157
11170
  await Promise.all([addedToBody.animate([{
11158
- width: $3hooq$solidjs.untrack(inModalFieldWidth),
11159
- left: "50%",
11160
- transform: "translateX(-50%)"
11171
+ width: $3hooq$solidjs.untrack(inModalFieldWidthPx),
11172
+ left: "".concat($3hooq$solidjs.untrack(innerWidthReactive) / 2 - $3hooq$solidjs.untrack(inModalFieldWidth) / 2, "px")
11161
11173
  }, {
11162
11174
  width: width + "px",
11163
- left: left + "px",
11164
- transform: "translateX(0%)"
11175
+ left: left + "px"
11165
11176
  }], {
11166
11177
  duration: closeDuration,
11167
11178
  fill: "forwards",
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "4.0.0";
13
+ export const version = "4.0.1";
14
14
  export type ModalAlignmentSignals = {
15
15
  body_: Signal<JSX.CSSProperties>;
16
16
  field_: Signal<JSX.CSSProperties>;
@@ -642,7 +642,7 @@ export type BaseSearchProviderConfig<InputDisplay extends Display, PossibleTrans
642
642
  */
643
643
  enableContentSearch?: boolean;
644
644
  /**
645
- * The search modal component to use. You can switch between the classic and the new search modal. Provide one of the components here that you can import from the same package as the one you're using to see this message.
645
+ * The search modal component to use. You can switch between the classic and the new search modal. Provide one of the components here that you can import from the same package as the one you're using to see this message (`SearchModalV2` or `ClassicSearchModal`).
646
646
  * You also need to reflect the choice in SCSS, example:
647
647
  * ```scss
648
648
  * @use "@depict-ai/js-ui" as plp-styling with (
@@ -10,7 +10,7 @@ import { createStore as $b8hua$createStore, reconcile as $b8hua$reconcile } from
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "4.0.0";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.0.1";
14
14
  function $a604a8ffa4e4c03f$export$e417c49320921907(dependency, fetcher) {
15
15
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $b8hua$createSignal();
16
16
  const deparallelizedFetcher = $b8hua$deparallelize_no_drop(async dependencyValue => {
@@ -10971,30 +10971,37 @@ function $937791b86d3d1509$export$44f738469d5570cf(_ref) {
10971
10971
  modalSearchFieldOuterWidth_: modalSearchFieldOuterWidth_
10972
10972
  } = _ref;
10973
10973
  return $b8hua$createRoot(dispose => {
10974
+ const [innerWidthReactive, setInnerWidthReactive] = $b8hua$createSignal(innerWidth);
10975
+ const resizeObserver = new ResizeObserver(records => setInnerWidthReactive(records.at(-1).contentRect.width));
10976
+ const {
10977
+ left: left,
10978
+ top: top,
10979
+ width: width
10980
+ } = actualField_.getBoundingClientRect();
10974
10981
  const fakeField = makeFakeField_();
10975
10982
  const owner = $b8hua$getOwner();
10976
10983
  const inModalFieldWidth = $b8hua$createMemo(
10977
10984
  // Can't have `min(${modalSearchFieldOuterWidth_()}px, var(--field-max-width, 600px))` because the WAAPI doesn't support that, so we need ot calculate it in JS
10978
- () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")) + "px");
10985
+ () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")));
10986
+ const inModalFieldWidthPx = $b8hua$createMemo(() => inModalFieldWidth() + "px");
10987
+ let disableResizePollingTimeout;
10988
+ resizeObserver.observe(document.documentElement);
10989
+ $b8hua$onCleanup(() => resizeObserver.disconnect());
10979
10990
  actualField_.replaceWith(fakeField);
10980
10991
  // Don't move the wrapped div since that would confuse run_in_root_or_auto_cleanup, but do actually move the field the user clicked around so that all selection stuff etc. is easier
10981
10992
  const addedToBody = wrap_ ? $b8hua$ssr($937791b86d3d1509$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape(actualField_)) : actualField_;
10982
10993
  document.body.append(addedToBody);
10983
- const {
10984
- left: left,
10985
- top: top,
10986
- width: width
10987
- } = fakeField.getBoundingClientRect();
10988
10994
  const zIndexOfFake = getComputedStyle(fakeField).zIndex;
10989
10995
  Object.assign(addedToBody.style, {
10990
10996
  position: "fixed",
10991
10997
  top: top + "px",
10998
+ left: left + "px",
10992
10999
  width: width + "px",
10993
11000
  ...(zIndexOfFake !== "auto" ? {
10994
11001
  zIndex: +zIndexOfFake + 1
10995
11002
  } : {})
10996
11003
  });
10997
- const pxOffCenter = innerWidth / 2 - (left + width / 2);
11004
+ const pxOffCenter = $b8hua$untrack(innerWidthReactive) / 2 - (left + width / 2);
10998
11005
  const openDuration = pxOffCenter > 100 ? 250 : 125; // faster animations if little left-right movement
10999
11006
  const closeDuration = pxOffCenter > 100 ? 150 : 100;
11000
11007
  setPollAlignment_(true);
@@ -11013,24 +11020,30 @@ function $937791b86d3d1509$export$44f738469d5570cf(_ref) {
11013
11020
  // Wait until the ResizeObserver has delivered a value in case that the modal is small or has much padding so we know that we can't animate our fake field to be wider than that
11014
11021
  addedToBody.animate([{
11015
11022
  left: left + "px",
11016
- transform: "translateX(0%)",
11017
11023
  width: width + "px"
11018
11024
  }, {
11019
- left: "50%",
11020
- transform: "translateX(-50%)",
11021
- width: $b8hua$untrack(inModalFieldWidth)
11025
+ left: "".concat($b8hua$untrack(innerWidthReactive) / 2 - $b8hua$untrack(inModalFieldWidth) / 2, "px"),
11026
+ width: $b8hua$untrack(inModalFieldWidthPx)
11022
11027
  }], {
11023
11028
  duration: openDuration,
11024
11029
  easing: "ease-in"
11025
11030
  }).finished.then(() => {
11026
11031
  setPollAlignment_(false);
11027
- $b8hua$runWithOwner(owner, () => $b8hua$createEffect(() =>
11028
- // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
11029
- Object.assign(addedToBody.style, {
11030
- left: "50%",
11031
- transform: "translateX(-50%)",
11032
- width: inModalFieldWidth()
11033
- })));
11032
+ $b8hua$runWithOwner(owner, () => $b8hua$createEffect(() => {
11033
+ // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
11034
+ Object.assign(addedToBody.style, {
11035
+ // This is left: 50%, transform: translateX(-50) with extra steps but when using it safari and firefox glitch out like crazy
11036
+ left: "".concat(innerWidthReactive() / 2 - inModalFieldWidth() / 2, "px"),
11037
+ width: inModalFieldWidthPx()
11038
+ });
11039
+ // We might only have changed the left position which align_field doesn't know about, make it poll the position for a while
11040
+ setPollAlignment_(true);
11041
+ if (disableResizePollingTimeout) clearTimeout(disableResizePollingTimeout);
11042
+ disableResizePollingTimeout = setTimeout($b8hua$catchify(() => {
11043
+ setPollAlignment_(false);
11044
+ disableResizePollingTimeout = undefined;
11045
+ }), 1000);
11046
+ }));
11034
11047
  });
11035
11048
  return true;
11036
11049
  }, false);
@@ -11073,13 +11086,11 @@ function $937791b86d3d1509$export$44f738469d5570cf(_ref) {
11073
11086
  transition: "opacity ".concat(closeDuration, "ms ease-out")
11074
11087
  }));
11075
11088
  await Promise.all([addedToBody.animate([{
11076
- width: $b8hua$untrack(inModalFieldWidth),
11077
- left: "50%",
11078
- transform: "translateX(-50%)"
11089
+ width: $b8hua$untrack(inModalFieldWidthPx),
11090
+ left: "".concat($b8hua$untrack(innerWidthReactive) / 2 - $b8hua$untrack(inModalFieldWidth) / 2, "px")
11079
11091
  }, {
11080
11092
  width: width + "px",
11081
- left: left + "px",
11082
- transform: "translateX(0%)"
11093
+ left: left + "px"
11083
11094
  }], {
11084
11095
  duration: closeDuration,
11085
11096
  fill: "forwards",
@@ -86,7 +86,7 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad99
86
86
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
87
87
  $parcel$export(module.exports, "SearchField", () => $c0a0659cf97e8eb2$export$316f6f283ae64765);
88
88
  /*! Depict.ai search and product listing SDK */
89
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.0.0";
89
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.0.1";
90
90
  function $53df95e470b2f8d2$export$e417c49320921907(dependency, fetcher) {
91
91
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $5vyXB$solidjs.createSignal();
92
92
  const deparallelizedFetcher = $5vyXB$depictaiutilishared.deparallelize_no_drop(async dependencyValue => {
@@ -10304,30 +10304,37 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
10304
10304
  modalSearchFieldOuterWidth_: modalSearchFieldOuterWidth_
10305
10305
  }) {
10306
10306
  return $5vyXB$solidjs.createRoot(dispose => {
10307
+ const [innerWidthReactive, setInnerWidthReactive] = $5vyXB$solidjs.createSignal(innerWidth);
10308
+ const resizeObserver = new ResizeObserver(records => setInnerWidthReactive(records.at(-1).contentRect.width));
10309
+ const {
10310
+ left: left,
10311
+ top: top,
10312
+ width: width
10313
+ } = actualField_.getBoundingClientRect();
10307
10314
  const fakeField = makeFakeField_();
10308
10315
  const owner = $5vyXB$solidjs.getOwner();
10309
10316
  const inModalFieldWidth = $5vyXB$solidjs.createMemo(
10310
10317
  // Can't have `min(${modalSearchFieldOuterWidth_()}px, var(--field-max-width, 600px))` because the WAAPI doesn't support that, so we need ot calculate it in JS
10311
- () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")) + "px");
10318
+ () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")));
10319
+ const inModalFieldWidthPx = $5vyXB$solidjs.createMemo(() => inModalFieldWidth() + "px");
10320
+ let disableResizePollingTimeout;
10321
+ resizeObserver.observe(document.documentElement);
10322
+ $5vyXB$solidjs.onCleanup(() => resizeObserver.disconnect());
10312
10323
  actualField_.replaceWith(fakeField);
10313
10324
  // Don't move the wrapped div since that would confuse run_in_root_or_auto_cleanup, but do actually move the field the user clicked around so that all selection stuff etc. is easier
10314
10325
  const addedToBody = wrap_ ? $5vyXB$solidjsweb.ssr($5cbaffcb5602e671$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(actualField_)) : actualField_;
10315
10326
  document.body.append(addedToBody);
10316
- const {
10317
- left: left,
10318
- top: top,
10319
- width: width
10320
- } = fakeField.getBoundingClientRect();
10321
10327
  const zIndexOfFake = getComputedStyle(fakeField).zIndex;
10322
10328
  Object.assign(addedToBody.style, {
10323
10329
  position: "fixed",
10324
10330
  top: top + "px",
10331
+ left: left + "px",
10325
10332
  width: width + "px",
10326
10333
  ...(zIndexOfFake !== "auto" ? {
10327
10334
  zIndex: +zIndexOfFake + 1
10328
10335
  } : {})
10329
10336
  });
10330
- const pxOffCenter = innerWidth / 2 - (left + width / 2);
10337
+ const pxOffCenter = $5vyXB$solidjs.untrack(innerWidthReactive) / 2 - (left + width / 2);
10331
10338
  const openDuration = pxOffCenter > 100 ? 250 : 125; // faster animations if little left-right movement
10332
10339
  const closeDuration = pxOffCenter > 100 ? 150 : 100;
10333
10340
  setPollAlignment_(true);
@@ -10346,24 +10353,30 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
10346
10353
  // Wait until the ResizeObserver has delivered a value in case that the modal is small or has much padding so we know that we can't animate our fake field to be wider than that
10347
10354
  addedToBody.animate([{
10348
10355
  left: left + "px",
10349
- transform: "translateX(0%)",
10350
10356
  width: width + "px"
10351
10357
  }, {
10352
- left: "50%",
10353
- transform: "translateX(-50%)",
10354
- width: $5vyXB$solidjs.untrack(inModalFieldWidth)
10358
+ left: `${$5vyXB$solidjs.untrack(innerWidthReactive) / 2 - $5vyXB$solidjs.untrack(inModalFieldWidth) / 2}px`,
10359
+ width: $5vyXB$solidjs.untrack(inModalFieldWidthPx)
10355
10360
  }], {
10356
10361
  duration: openDuration,
10357
10362
  easing: "ease-in"
10358
10363
  }).finished.then(() => {
10359
10364
  setPollAlignment_(false);
10360
- $5vyXB$solidjs.runWithOwner(owner, () => $5vyXB$solidjs.createEffect(() =>
10361
- // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
10362
- Object.assign(addedToBody.style, {
10363
- left: "50%",
10364
- transform: "translateX(-50%)",
10365
- width: inModalFieldWidth()
10366
- })));
10365
+ $5vyXB$solidjs.runWithOwner(owner, () => $5vyXB$solidjs.createEffect(() => {
10366
+ // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
10367
+ Object.assign(addedToBody.style, {
10368
+ // This is left: 50%, transform: translateX(-50) with extra steps but when using it safari and firefox glitch out like crazy
10369
+ left: `${innerWidthReactive() / 2 - inModalFieldWidth() / 2}px`,
10370
+ width: inModalFieldWidthPx()
10371
+ });
10372
+ // We might only have changed the left position which align_field doesn't know about, make it poll the position for a while
10373
+ setPollAlignment_(true);
10374
+ if (disableResizePollingTimeout) clearTimeout(disableResizePollingTimeout);
10375
+ disableResizePollingTimeout = setTimeout($5vyXB$depictaiutilishared.catchify(() => {
10376
+ setPollAlignment_(false);
10377
+ disableResizePollingTimeout = undefined;
10378
+ }), 1000);
10379
+ }));
10367
10380
  });
10368
10381
  return true;
10369
10382
  }, false);
@@ -10406,13 +10419,11 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
10406
10419
  transition: `opacity ${closeDuration}ms ease-out`
10407
10420
  }));
10408
10421
  await Promise.all([addedToBody.animate([{
10409
- width: $5vyXB$solidjs.untrack(inModalFieldWidth),
10410
- left: "50%",
10411
- transform: "translateX(-50%)"
10422
+ width: $5vyXB$solidjs.untrack(inModalFieldWidthPx),
10423
+ left: `${$5vyXB$solidjs.untrack(innerWidthReactive) / 2 - $5vyXB$solidjs.untrack(inModalFieldWidth) / 2}px`
10412
10424
  }, {
10413
10425
  width: width + "px",
10414
- left: left + "px",
10415
- transform: "translateX(0%)"
10426
+ left: left + "px"
10416
10427
  }], {
10417
10428
  duration: closeDuration,
10418
10429
  fill: "forwards",
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "4.0.0";
13
+ export const version = "4.0.1";
14
14
  export type ModalAlignmentSignals = {
15
15
  body_: Signal<JSX.CSSProperties>;
16
16
  field_: Signal<JSX.CSSProperties>;
@@ -642,7 +642,7 @@ export type BaseSearchProviderConfig<InputDisplay extends Display, PossibleTrans
642
642
  */
643
643
  enableContentSearch?: boolean;
644
644
  /**
645
- * The search modal component to use. You can switch between the classic and the new search modal. Provide one of the components here that you can import from the same package as the one you're using to see this message.
645
+ * The search modal component to use. You can switch between the classic and the new search modal. Provide one of the components here that you can import from the same package as the one you're using to see this message (`SearchModalV2` or `ClassicSearchModal`).
646
646
  * You also need to reflect the choice in SCSS, example:
647
647
  * ```scss
648
648
  * @use "@depict-ai/js-ui" as plp-styling with (
@@ -7,7 +7,7 @@ import { createStore as $i7OB2$createStore, reconcile as $i7OB2$reconcile } from
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "4.0.0";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.0.1";
11
11
  function $136f1d4d6c7ba6ac$export$e417c49320921907(dependency, fetcher) {
12
12
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $i7OB2$createSignal();
13
13
  const deparallelizedFetcher = $i7OB2$deparallelize_no_drop(async dependencyValue => {
@@ -10225,30 +10225,37 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
10225
10225
  modalSearchFieldOuterWidth_: modalSearchFieldOuterWidth_
10226
10226
  }) {
10227
10227
  return $i7OB2$createRoot(dispose => {
10228
+ const [innerWidthReactive, setInnerWidthReactive] = $i7OB2$createSignal(innerWidth);
10229
+ const resizeObserver = new ResizeObserver(records => setInnerWidthReactive(records.at(-1).contentRect.width));
10230
+ const {
10231
+ left: left,
10232
+ top: top,
10233
+ width: width
10234
+ } = actualField_.getBoundingClientRect();
10228
10235
  const fakeField = makeFakeField_();
10229
10236
  const owner = $i7OB2$getOwner();
10230
10237
  const inModalFieldWidth = $i7OB2$createMemo(
10231
10238
  // Can't have `min(${modalSearchFieldOuterWidth_()}px, var(--field-max-width, 600px))` because the WAAPI doesn't support that, so we need ot calculate it in JS
10232
- () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")) + "px");
10239
+ () => Math.min(modalSearchFieldOuterWidth_(), parseFloat(getComputedStyle(actualField_).getPropertyValue("--field-max-width") || "600")));
10240
+ const inModalFieldWidthPx = $i7OB2$createMemo(() => inModalFieldWidth() + "px");
10241
+ let disableResizePollingTimeout;
10242
+ resizeObserver.observe(document.documentElement);
10243
+ $i7OB2$onCleanup(() => resizeObserver.disconnect());
10233
10244
  actualField_.replaceWith(fakeField);
10234
10245
  // Don't move the wrapped div since that would confuse run_in_root_or_auto_cleanup, but do actually move the field the user clicked around so that all selection stuff etc. is easier
10235
10246
  const addedToBody = wrap_ ? $i7OB2$ssr($0e562a5b247b1fc2$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(actualField_)) : actualField_;
10236
10247
  document.body.append(addedToBody);
10237
- const {
10238
- left: left,
10239
- top: top,
10240
- width: width
10241
- } = fakeField.getBoundingClientRect();
10242
10248
  const zIndexOfFake = getComputedStyle(fakeField).zIndex;
10243
10249
  Object.assign(addedToBody.style, {
10244
10250
  position: "fixed",
10245
10251
  top: top + "px",
10252
+ left: left + "px",
10246
10253
  width: width + "px",
10247
10254
  ...(zIndexOfFake !== "auto" ? {
10248
10255
  zIndex: +zIndexOfFake + 1
10249
10256
  } : {})
10250
10257
  });
10251
- const pxOffCenter = innerWidth / 2 - (left + width / 2);
10258
+ const pxOffCenter = $i7OB2$untrack(innerWidthReactive) / 2 - (left + width / 2);
10252
10259
  const openDuration = pxOffCenter > 100 ? 250 : 125; // faster animations if little left-right movement
10253
10260
  const closeDuration = pxOffCenter > 100 ? 150 : 100;
10254
10261
  setPollAlignment_(true);
@@ -10267,24 +10274,30 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
10267
10274
  // Wait until the ResizeObserver has delivered a value in case that the modal is small or has much padding so we know that we can't animate our fake field to be wider than that
10268
10275
  addedToBody.animate([{
10269
10276
  left: left + "px",
10270
- transform: "translateX(0%)",
10271
10277
  width: width + "px"
10272
10278
  }, {
10273
- left: "50%",
10274
- transform: "translateX(-50%)",
10275
- width: $i7OB2$untrack(inModalFieldWidth)
10279
+ left: `${$i7OB2$untrack(innerWidthReactive) / 2 - $i7OB2$untrack(inModalFieldWidth) / 2}px`,
10280
+ width: $i7OB2$untrack(inModalFieldWidthPx)
10276
10281
  }], {
10277
10282
  duration: openDuration,
10278
10283
  easing: "ease-in"
10279
10284
  }).finished.then(() => {
10280
10285
  setPollAlignment_(false);
10281
- $i7OB2$runWithOwner(owner, () => $i7OB2$createEffect(() =>
10282
- // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
10283
- Object.assign(addedToBody.style, {
10284
- left: "50%",
10285
- transform: "translateX(-50%)",
10286
- width: inModalFieldWidth()
10287
- })));
10286
+ $i7OB2$runWithOwner(owner, () => $i7OB2$createEffect(() => {
10287
+ // When animation has finished, still dynamically set the size of the search field behind in case the user resizes the window
10288
+ Object.assign(addedToBody.style, {
10289
+ // This is left: 50%, transform: translateX(-50) with extra steps but when using it safari and firefox glitch out like crazy
10290
+ left: `${innerWidthReactive() / 2 - inModalFieldWidth() / 2}px`,
10291
+ width: inModalFieldWidthPx()
10292
+ });
10293
+ // We might only have changed the left position which align_field doesn't know about, make it poll the position for a while
10294
+ setPollAlignment_(true);
10295
+ if (disableResizePollingTimeout) clearTimeout(disableResizePollingTimeout);
10296
+ disableResizePollingTimeout = setTimeout($i7OB2$catchify(() => {
10297
+ setPollAlignment_(false);
10298
+ disableResizePollingTimeout = undefined;
10299
+ }), 1000);
10300
+ }));
10288
10301
  });
10289
10302
  return true;
10290
10303
  }, false);
@@ -10327,13 +10340,11 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
10327
10340
  transition: `opacity ${closeDuration}ms ease-out`
10328
10341
  }));
10329
10342
  await Promise.all([addedToBody.animate([{
10330
- width: $i7OB2$untrack(inModalFieldWidth),
10331
- left: "50%",
10332
- transform: "translateX(-50%)"
10343
+ width: $i7OB2$untrack(inModalFieldWidthPx),
10344
+ left: `${$i7OB2$untrack(innerWidthReactive) / 2 - $i7OB2$untrack(inModalFieldWidth) / 2}px`
10333
10345
  }, {
10334
10346
  width: width + "px",
10335
- left: left + "px",
10336
- transform: "translateX(0%)"
10347
+ left: left + "px"
10337
10348
  }], {
10338
10349
  duration: closeDuration,
10339
10350
  fill: "forwards",