saltfish 0.2.45 → 0.2.47

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.
@@ -5880,10 +5880,13 @@ class CursorManager {
5880
5880
  async scrollElementIntoView(element) {
5881
5881
  return new Promise((resolve) => {
5882
5882
  const scrollableParents = this.findScrollableParents(element);
5883
+ const elementRect = element.getBoundingClientRect();
5884
+ const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
5885
+ const scrollBlock = elementRect.height > viewportHeight ? "start" : "center";
5883
5886
  if (scrollableParents.length === 0) {
5884
5887
  element.scrollIntoView({
5885
5888
  behavior: "smooth",
5886
- block: "center",
5889
+ block: scrollBlock,
5887
5890
  inline: "center"
5888
5891
  });
5889
5892
  this.waitForScrollComplete(window, resolve);
@@ -5892,7 +5895,7 @@ class CursorManager {
5892
5895
  if (!this.isElementInViewport(element)) {
5893
5896
  element.scrollIntoView({
5894
5897
  behavior: "smooth",
5895
- block: "center",
5898
+ block: scrollBlock,
5896
5899
  inline: "center"
5897
5900
  });
5898
5901
  }
@@ -5928,7 +5931,12 @@ class CursorManager {
5928
5931
  const parentRect = parent.getBoundingClientRect();
5929
5932
  const scrollTop = parent.scrollTop;
5930
5933
  const scrollLeft = parent.scrollLeft;
5931
- const targetScrollTop = scrollTop + (elementRect.top - parentRect.top) - parentRect.height / 2 + elementRect.height / 2;
5934
+ let targetScrollTop;
5935
+ if (elementRect.height > parentRect.height) {
5936
+ targetScrollTop = scrollTop + (elementRect.top - parentRect.top);
5937
+ } else {
5938
+ targetScrollTop = scrollTop + (elementRect.top - parentRect.top) - parentRect.height / 2 + elementRect.height / 2;
5939
+ }
5932
5940
  const targetScrollLeft = scrollLeft + (elementRect.left - parentRect.left) - parentRect.width / 2 + elementRect.width / 2;
5933
5941
  parent.scrollTo({
5934
5942
  top: Math.max(0, targetScrollTop),
@@ -10304,7 +10312,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
10304
10312
  __proto__: null,
10305
10313
  SaltfishPlayer
10306
10314
  }, Symbol.toStringTag, { value: "Module" }));
10307
- const version = "0.2.45";
10315
+ const version = "0.2.47";
10308
10316
  const packageJson = {
10309
10317
  version
10310
10318
  };