@fluid-topics/ft-reader-content 1.1.79 → 1.1.81

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.
@@ -28,7 +28,7 @@
28
28
  display: flow-root;
29
29
  min-height: ${M.itemContainerMinHeight};
30
30
  }
31
- `;var p=function(s,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,r);else for(var n=s.length-1;n>=0;n--)(l=s[n])&&(i=(o<3?l(i):o>3?l(e,t,i):l(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},L=class extends CustomEvent{constructor(e,t){super("visible-items-change",{detail:{visibleIndexes:e,visibleItems:t}})}},P=class extends Event{constructor(){super("scrolled-to-target")}},Te=s=>(s??[])[(s??[]).length-1],c=class extends d.FtLitElement{constructor(){super(...arguments),this.items=[],this.renderItem=()=>x.html``,this.getItemKey=(e,t)=>`${t} - ${JSON.stringify(e)}`,this.internalScroll=!1,this.renderBeforeFirst=1,this.renderAfterLast=1,this.ensureScrollToTarget=!1,this.visibleItems=[],this.scrolledToTarget=!1,this.scrolling=!1,this.renderApprovalTimeouts=[],this.renderedIndexes=new Set,this.scrollDebouncer=new d.Debouncer(5),this.scrollDoneDebouncer=new d.Debouncer(10),this.onVisibilityChange=e=>{let t=new Set(this.visibleItems),r=new Set;for(let o of e){let i=+o.target.getAttribute("data-item-index");o.intersectionRect.height>0?(t.add(i),r.add(i)):r.has(i)||t.delete(i)}this.visibleItems=[...t].sort((o,i)=>o-i)},this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange),this.scrollingDebouncer=new d.Debouncer(50),this.ignoreNextScrollEvent=!1,this.scrollListener=()=>{var e;let t=this.ignoreNextScrollEvent;this.ignoreNextScrollEvent=!1,t||(this.scrolling=!0,this.scrollingDebouncer.run(()=>this.scrolling=!1));let r=this.scrollable.scrollTop,o=r-((e=this.lastScrollTop)!==null&&e!==void 0?e:0);if(this.lastScrollTop=r,this.scrolledToTarget){this.restoreScrollIfNeeded(t?0:o);let i=this.searchFirstVisibleItem(r,this.itemsContainer.children);this.scrollRestorationItem=i?+i.getAttribute("data-item-index"):void 0,this.scrollRestorationOffset=r-this.getOffset(i)}},this.restoreScrollIfNeeded=(e=0)=>{var t;let r=this.scrollable.scrollHeight,o=r-((t=this.lastScrollHeight)!==null&&t!==void 0?t:r);if(this.lastScrollHeight=r,o!==0&&this.scrollRestorationItem!=null&&this.scrollRestorationOffset!=null&&this.scrolledToTarget){let i=this.getItem(this.scrollRestorationItem),l=this.getOffset(i),n=(0,d.minmax)(this.scrollRestorationItem===0?-l:1,this.scrollRestorationOffset,i.clientHeight-1),O=l+n+e-this.scrollable.scrollTop;(Math.abs(o-O)<4||Math.abs(O)>5)&&(this.ignoreNextScrollEvent=!0,this.scrollable.scrollTop+=O)}},this._shouldRestoreScroll=!1,this.scrollAdjustment=()=>{this.restoreScrollIfNeeded(),this.shouldRestoreScroll&&requestAnimationFrame(this.scrollAdjustment)},this.onMutation=()=>{for(let e of this.itemsContainer.children)this.intersectionObserver.observe(e)},this.mutationObserver=new MutationObserver(this.onMutation),this.resetVisibleItemsDebouncer=new d.Debouncer(10)}get scrollable(){var e;return(e=this._scrollable)!==null&&e!==void 0?e:document.body}set scrollable(e){var t,r,o,i;this._scrollable!==e&&((t=this._scrollable)===null||t===void 0||t.removeEventListener("scroll",this.scrollListener),this._scrollable&&this.initialOverflowAnchorValue&&(this.scrollable.style.overflowAnchor=this.initialOverflowAnchorValue),this._scrollable=e,(r=this._scrollable)===null||r===void 0||r.addEventListener("scroll",this.scrollListener),this.lastScrollTop=(o=this._scrollable)===null||o===void 0?void 0:o.scrollTop,this.lastScrollHeight=(i=this._scrollable)===null||i===void 0?void 0:i.scrollHeight,this._scrollable&&(this.initialOverflowAnchorValue=getComputedStyle(this._scrollable).overflowAnchor,this._scrollable.style.overflowAnchor="none"))}render(){return x.html`
31
+ `;var p=function(s,e,t,r){var o=arguments.length,i=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,e,t,r);else for(var n=s.length-1;n>=0;n--)(l=s[n])&&(i=(o<3?l(i):o>3?l(e,t,i):l(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},L=class extends CustomEvent{constructor(e,t){super("visible-items-change",{detail:{visibleIndexes:e,visibleItems:t}})}},P=class extends Event{constructor(){super("scrolled-to-target")}},Te=s=>(s??[])[(s??[]).length-1],c=class extends d.FtLitElement{constructor(){super(...arguments),this.items=[],this.renderItem=()=>x.html``,this.getItemKey=(e,t)=>`${t} - ${JSON.stringify(e)}`,this.internalScroll=!1,this.renderBeforeFirst=1,this.renderAfterLast=1,this.ensureScrollToTarget=!1,this.visibleItems=[],this.scrolledToTarget=!1,this.scrolling=!1,this.renderApprovalTimeouts=[],this.renderedIndexes=new Set,this.scrollDebouncer=new d.Debouncer(5),this.scrollDoneDebouncer=new d.Debouncer(10),this.onVisibilityChange=e=>{let t=new Set(this.visibleItems),r=new Set;for(let o of e){let i=+o.target.getAttribute("data-item-index");o.intersectionRect.height>0?(t.add(i),r.add(i)):r.has(i)||t.delete(i)}this.visibleItems=[...t].sort((o,i)=>o-i)},this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange),this.scrollingDebouncer=new d.Debouncer(50),this.ignoreNextScrollEvent=!1,this.scrollListener=()=>{var e;let t=this.ignoreNextScrollEvent;this.ignoreNextScrollEvent=!1,t||(this.scrolling=!0,this.scrollingDebouncer.run(()=>this.scrolling=!1));let r=this.scrollable.scrollTop,o=r-((e=this.lastScrollTop)!==null&&e!==void 0?e:0);if(this.lastScrollTop=r,this.scrolledToTarget&&(this.restoreScrollIfNeeded(t?0:o),!t||this.scrollRestorationItem==null)){let i=this.searchFirstVisibleItem(r,this.itemsContainer.children);this.scrollRestorationItem=i?+i.getAttribute("data-item-index"):void 0,this.scrollRestorationOffset=r-this.getOffset(i)}},this.restoreScrollIfNeeded=(e=0)=>{var t;let r=this.scrollable.scrollHeight,o=r-((t=this.lastScrollHeight)!==null&&t!==void 0?t:r);if(this.lastScrollHeight=r,o!==0&&this.scrollRestorationItem!=null&&this.scrollRestorationOffset!=null&&this.scrolledToTarget){let i=this.getItem(this.scrollRestorationItem),l=this.getOffset(i),n=(0,d.minmax)(this.scrollRestorationItem===0?-l:1,this.scrollRestorationOffset,i.clientHeight-1),O=l+n+e-this.scrollable.scrollTop;(Math.abs(o-O)<4||Math.abs(O)>5)&&(this.ignoreNextScrollEvent=!0,this.scrollable.scrollTop+=O)}},this._shouldRestoreScroll=!1,this.scrollAdjustment=()=>{this.restoreScrollIfNeeded(),this.shouldRestoreScroll&&requestAnimationFrame(this.scrollAdjustment)},this.onMutation=()=>{for(let e of this.itemsContainer.children)this.intersectionObserver.observe(e)},this.mutationObserver=new MutationObserver(this.onMutation),this.resetVisibleItemsDebouncer=new d.Debouncer(10)}get scrollable(){var e;return(e=this._scrollable)!==null&&e!==void 0?e:document.body}set scrollable(e){var t,r,o,i;this._scrollable!==e&&((t=this._scrollable)===null||t===void 0||t.removeEventListener("scroll",this.scrollListener),this._scrollable&&this.initialOverflowAnchorValue&&(this.scrollable.style.overflowAnchor=this.initialOverflowAnchorValue),this._scrollable=e,(r=this._scrollable)===null||r===void 0||r.addEventListener("scroll",this.scrollListener),this.lastScrollTop=(o=this._scrollable)===null||o===void 0?void 0:o.scrollTop,this.lastScrollHeight=(i=this._scrollable)===null||i===void 0?void 0:i.scrollHeight,this._scrollable&&(this.initialOverflowAnchorValue=getComputedStyle(this._scrollable).overflowAnchor,this._scrollable.style.overflowAnchor="none"))}render(){return x.html`
32
32
  <div class="items-container ${this.internalScroll?"scrollable":""}"
33
33
  tabindex="-1"
34
34
  @find-scrollable-parent=${this.findScrollableParent}>