//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// TypeScript support for Blazor-WASM application | Author: Sergei Y.Kitaev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Page-functions (static class):
class Page {
   static GetScrollLeft(): number {
      return Magistral.GetScrollLeft()
   }
   static GetScrollTop(): number {
      return Magistral.GetScrollTop()
   }

   static ScrollTo(scrollLeft: number|null, scrollTop: number|null): boolean {
      return Magistral.ScrollTo(scrollLeft, scrollTop)
   }
   static DeferredScrollTo( scrollLeft: number|null,
                            scrollTop: number|null,
                            milliseconds: number=0 ): boolean {
      return Magistral.DeferredScrollTo(scrollLeft, scrollTop, milliseconds)
   }

   static ScrollToTop(): boolean {
      return Magistral.ScrollToPageTop()
   }
   static DeferredScrollToTop(milliseconds: number=0): boolean {
      return Magistral.DeferredScrollToPageTop(milliseconds)
   }
   static ScrollToBottom(): boolean {
      return Magistral.ScrollToPageBottom()
   }
   static DeferredScrollToBottom(milliseconds: number=0): boolean {
      return Magistral.DeferredScrollToPageBottom(milliseconds)
   }

   static FocusBackground(): boolean {
      return Magistral.FocusPageBackground()
   }
   static DeferredFocusBackground(milliseconds: number=0): boolean {
      return Magistral.DeferredFocusPageBackground(milliseconds)
   }

   static Unscroll() {
      Page.ScrollTo(0, 0)
   }
   static DeferredUnscroll(milliseconds: number=0) {
      milliseconds = HOps.NullSubst(milliseconds, 0)
      setTimeout(Page.Unscroll, milliseconds)
   }

   static ClearSelectionUnscroll() {
      HDoc.ClearSelection()
      Page.Unscroll()
   }
   static ClearSelectionDeferredUnscroll(milliseconds: number=0) {
      HDoc.ClearSelection()
      Page.DeferredUnscroll(milliseconds)
   }
} // Page

//==================================================================================================
// Page — INITIALIZATION:
//--------------------------------------------------------------------------------------------------

//==================================================================================================
// Page — FUNCTIONS:
//--------------------------------------------------------------------------------------------------

function Page_GetScrollLeft(): number {
   return Page.GetScrollLeft()
}
function Page_GetScrollTop(): number {
   return Page.GetScrollTop()
}

function Page_ScrollTo(scrollLeft: number|null, scrollTop: number|null) {
   Page.ScrollTo(scrollLeft, scrollTop)
}
function Page_DeferredScrollTo( scrollLeft: number|null,
                                scrollTop: number|null,
                                milliseconds: number=0 ) {
   Page.DeferredScrollTo(scrollLeft, scrollTop, milliseconds)
}

function Page_ScrollToTop(): boolean {
   return Page.ScrollToTop()
}
function Page_DeferredScrollToTop(milliseconds: number=0): boolean {
   return Page.DeferredScrollToTop(milliseconds)
}
function Page_ScrollToBottom(): boolean {
   return Page.ScrollToBottom()
}
function Page_DeferredScrollToBottom(milliseconds: number=0): boolean {
   return Page.DeferredScrollToBottom(milliseconds)
}

function Page_FocusBackground(): boolean {
   return Page.FocusBackground()
}
function Page_DeferredFocusBackground(milliseconds: number=0): boolean {
   return Page.DeferredFocusBackground(milliseconds)
}

function Page_Unscroll() {
   Page.Unscroll()
}
function Page_DeferredUnscroll(milliseconds: number=0) {
   setTimeout(Page.Unscroll, milliseconds)
}

function Page_ClearSelection() {
   HDoc.ClearSelection()
}
function Page_ClearSelectionUnscroll() {
   Page.ClearSelectionUnscroll()
}
function Page_ClearSelectionDeferredUnscroll(milliseconds: number=0) {
   Page.ClearSelectionDeferredUnscroll(milliseconds)
}

//==================================================================================================
