@cloudflare/ai-search-snippet 0.0.35 → 0.0.37

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.
@@ -138,6 +138,7 @@ class K {
138
138
  headers: {
139
139
  ...j(s?.headers),
140
140
  "Content-Type": "application/json",
141
+ Accept: i.stream ? "text/event-stream" : "application/json",
141
142
  "cf-ai-search-source": r
142
143
  },
143
144
  signal: t
@@ -3638,13 +3639,14 @@ ${se}`;
3638
3639
  overflow: document.body.style.overflow,
3639
3640
  position: document.body.style.position,
3640
3641
  top: document.body.style.top,
3641
- width: document.body.style.width
3642
- }, this.savedHtmlOverflow = document.documentElement.style.overflow, document.documentElement.style.overflow = "hidden", document.body.style.overflow = "hidden", document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.width = "100%";
3642
+ width: document.body.style.width,
3643
+ scrollbarGutter: document.body.style.scrollbarGutter
3644
+ }, this.savedHtmlOverflow = document.documentElement.style.overflow, document.body.style.scrollbarGutter = "stable", document.documentElement.style.overflow = "hidden", document.body.style.overflow = "hidden", document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.width = "100%";
3643
3645
  }
3644
3646
  unlockBodyScroll() {
3645
3647
  if (!this.savedBodyStyles) return;
3646
3648
  const e = Math.abs(Number.parseInt(document.body.style.top || "0", 10));
3647
- document.documentElement.style.overflow = this.savedHtmlOverflow || "", document.body.style.overflow = this.savedBodyStyles.overflow, document.body.style.position = this.savedBodyStyles.position, document.body.style.top = this.savedBodyStyles.top, document.body.style.width = this.savedBodyStyles.width, window.scrollTo(0, e), this.savedBodyStyles = null, this.savedHtmlOverflow = null;
3649
+ document.documentElement.style.overflow = this.savedHtmlOverflow || "", document.body.style.overflow = this.savedBodyStyles.overflow, document.body.style.position = this.savedBodyStyles.position, document.body.style.top = this.savedBodyStyles.top, document.body.style.width = this.savedBodyStyles.width, document.body.style.scrollbarGutter = this.savedBodyStyles.scrollbarGutter || "", window.scrollTo(0, e), this.savedBodyStyles = null, this.savedHtmlOverflow = null;
3648
3650
  }
3649
3651
  cleanup() {
3650
3652
  this.clearLoadingInterval(), this.currentSearchController && (this.currentSearchController.abort(), this.currentSearchController = null), this.handleGlobalKeydown && (document.removeEventListener("keydown", this.handleGlobalKeydown), this.handleGlobalKeydown = null), this.inputElement && (this.handleInputChange && this.inputElement.removeEventListener("input", this.handleInputChange), this.handleInputKeydown && this.inputElement.removeEventListener("keydown", this.handleInputKeydown)), this.backdrop && this.handleBackdropClick && this.backdrop.removeEventListener("click", this.handleBackdropClick), this.handleInputChange = null, this.handleInputKeydown = null, this.handleBackdropClick = null, this.client && this.client.cancelAllRequests();