@fluid-topics/ft-reader-toc 1.1.12 → 1.1.13

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.
@@ -558,7 +558,7 @@ const V=Symbol.for(""),X=t=>{if(t?.r===V)return t?._$litStatic$},q=t=>({_$litSta
558
558
  @focusin=${this.onHover}
559
559
  @focusout=${this.onOut}
560
560
  @touchstart=${this.onTouch}>
561
- <slot part="slot"></slot>
561
+ <slot part="slot" @click=${this.onClick}></slot>
562
562
  <div part="tooltip" role="tooltip" inert
563
563
  class="ft-tooltip ft-tooltip--${this.validPosition}"
564
564
  ?hidden=${!this.visible}>
@@ -568,7 +568,7 @@ const V=Symbol.for(""),X=t=>{if(t?.r===V)return t?._$litStatic$},q=t=>({_$litSta
568
568
  </div>
569
569
  </div>
570
570
  </div>
571
- `}updated(t){t.has("visible")&&this.visible&&this.resetTooltipContent(),super.updated(t)}contentAvailableCallback(t){super.contentAvailableCallback(t),["visible","text"].some((o=>t.has(o)))&&this.visible&&this.positionTooltip()}show(t){this.visible=!0,null!=t&&this.hideDebounce.run((()=>this.hide()),t)}hide(){this.visible=!1}toggle(){this.visible=!this.visible}get slottedElement(){var t;return(null!==(t=this.slotNodes)&&void 0!==t?t:[]).filter((t=>t.nodeType==Node.ELEMENT_NODE))[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){const t=this.tooltipContent.style;switch(t.transition="none",this.validPosition){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px"}}}positionTooltip(){var t;this.resetTooltipContent(),this.tooltip&&this.slottedElement&&(this.tooltip.style.left="",this.tooltip.style.top="",pr(this.slottedElement,this.tooltip,{platform:{...sr,getOffsetParent:t=>sr.getOffsetParent(t,fr)},middleware:[(t={crossAxis:!0},void 0===t&&(t={}),{name:"shift",options:t,async fn(o){const{x:e,y:r,placement:i}=o,{mainAxis:a=!0,crossAxis:n=!1,limiter:l={fn:t=>{let{x:o,y:e}=t;return{x:o,y:e}}},...c}=ve(t,o),s={x:e,y:r},p=await Le(o,c),f=$e(Ne(i)),d=Ce(f);let h=s[d],g=s[f];if(a){const t="y"===d?"bottom":"right";h=Oe(h+p["y"===d?"top":"left"],h,h-p[t])}if(n){const t="y"===f?"bottom":"right";g=Oe(g+p["y"===f?"top":"left"],g,g-p[t])}const y=l.fn({...o,[d]:h,[f]:g});return{...y,data:{x:y.x-e,y:y.y-r}}}}),We({allowedPlacements:[this.position]})]}).then((({x:t,y:o})=>{this.tooltip&&(this.tooltip.style.left=`${t}px`,this.tooltip.style.top=`${o}px`)}))),this.revealDebouncer.run((()=>{this.tooltipContent&&(this.tooltipContent.style.transition="top var(--ft-transition-duration, 250ms), left var(--ft-transition-duration, 250ms)",this.tooltipContent.style.top="0",this.tooltipContent.style.left="0")}),this.manual?0:this.delay)}onTouch(){this.manual||(this.show(),setTimeout((()=>window.addEventListener("touchstart",(t=>{t.composedPath().includes(this.container)||this.onOut()}),{once:!0})),100))}onHover(){this.manual||this.show()}onOut(){this.manual||(this.revealDebouncer.cancel(),this.hide())}correctOutOfWindowPixels(t,o){return Math.max(t,Math.min(0,-o))}}gr.elementDefinitions={"ft-typography":wo},gr.styles=fe,hr([n.property()],gr.prototype,"text",void 0),hr([n.property({type:Boolean})],gr.prototype,"manual",void 0),hr([n.property({type:Boolean})],gr.prototype,"inline",void 0),hr([n.property({type:Number})],gr.prototype,"delay",void 0),hr([n.property()],gr.prototype,"position",void 0),hr([n.queryAssignedNodes()],gr.prototype,"slotNodes",void 0),hr([n.query(".ft-tooltip--container")],gr.prototype,"container",void 0),hr([n.query(".ft-tooltip")],gr.prototype,"tooltip",void 0),hr([n.query(".ft-tooltip--content")],gr.prototype,"tooltipContent",void 0),hr([n.state()],gr.prototype,"visible",void 0),hr([n.eventOptions({passive:!0})],gr.prototype,"onTouch",null),hr([n.eventOptions({passive:!0})],gr.prototype,"onHover",null),hr([n.eventOptions({passive:!0})],gr.prototype,"onOut",null),o.customElement("ft-tooltip")(gr);class yr extends o.FtLitElement{render(){return e.html`
571
+ `}updated(t){t.has("visible")&&this.visible&&this.resetTooltipContent(),super.updated(t)}contentAvailableCallback(t){super.contentAvailableCallback(t),["visible","text"].some((o=>t.has(o)))&&this.visible&&this.positionTooltip()}show(t){this.visible=!0,null!=t&&this.hideDebounce.run((()=>this.hide()),t)}hide(){this.visible=!1}toggle(){this.visible=!this.visible}get slottedElement(){var t;return(null!==(t=this.slotNodes)&&void 0!==t?t:[]).filter((t=>t.nodeType==Node.ELEMENT_NODE))[0]}resetTooltipContent(){if(this.tooltip&&this.tooltipContent){const t=this.tooltipContent.style;switch(t.transition="none",this.validPosition){case"top":t.top=this.tooltip.clientHeight+"px",t.left="0";break;case"bottom":t.top=-this.tooltip.clientHeight+"px",t.left="0";break;case"left":t.top="0",t.left=this.tooltip.clientWidth+"px";break;case"right":t.top="0",t.left=-this.tooltip.clientWidth+"px"}}}positionTooltip(){var t;this.resetTooltipContent(),this.tooltip&&this.slottedElement&&(this.tooltip.style.left="",this.tooltip.style.top="",pr(this.slottedElement,this.tooltip,{platform:{...sr,getOffsetParent:t=>sr.getOffsetParent(t,fr)},middleware:[(t={crossAxis:!0},void 0===t&&(t={}),{name:"shift",options:t,async fn(o){const{x:e,y:r,placement:i}=o,{mainAxis:a=!0,crossAxis:n=!1,limiter:l={fn:t=>{let{x:o,y:e}=t;return{x:o,y:e}}},...c}=ve(t,o),s={x:e,y:r},p=await Le(o,c),f=$e(Ne(i)),d=Ce(f);let h=s[d],g=s[f];if(a){const t="y"===d?"bottom":"right";h=Oe(h+p["y"===d?"top":"left"],h,h-p[t])}if(n){const t="y"===f?"bottom":"right";g=Oe(g+p["y"===f?"top":"left"],g,g-p[t])}const y=l.fn({...o,[d]:h,[f]:g});return{...y,data:{x:y.x-e,y:y.y-r}}}}),We({allowedPlacements:[this.position]})]}).then((({x:t,y:o})=>{this.tooltip&&(this.tooltip.style.left=`${t}px`,this.tooltip.style.top=`${o}px`)}))),this.revealDebouncer.run((()=>{this.tooltipContent&&(this.tooltipContent.style.transition="top var(--ft-transition-duration, 250ms), left var(--ft-transition-duration, 250ms)",this.tooltipContent.style.top="0",this.tooltipContent.style.left="0")}),this.manual?0:this.delay)}onTouch(){this.manual||(this.show(),setTimeout((()=>window.addEventListener("touchstart",(t=>{t.composedPath().includes(this.container)||this.onOut()}),{once:!0})),100))}onHover(){this.manual||this.show()}onOut(){this.manual||(this.revealDebouncer.cancel(),this.hide())}onClick(){this.manual||(this.revealDebouncer.cancel(),this.hide())}correctOutOfWindowPixels(t,o){return Math.max(t,Math.min(0,-o))}}gr.elementDefinitions={"ft-typography":wo},gr.styles=fe,hr([n.property()],gr.prototype,"text",void 0),hr([n.property({type:Boolean})],gr.prototype,"manual",void 0),hr([n.property({type:Boolean})],gr.prototype,"inline",void 0),hr([n.property({type:Number})],gr.prototype,"delay",void 0),hr([n.property()],gr.prototype,"position",void 0),hr([n.queryAssignedNodes()],gr.prototype,"slotNodes",void 0),hr([n.query(".ft-tooltip--container")],gr.prototype,"container",void 0),hr([n.query(".ft-tooltip")],gr.prototype,"tooltip",void 0),hr([n.query(".ft-tooltip--content")],gr.prototype,"tooltipContent",void 0),hr([n.state()],gr.prototype,"visible",void 0),hr([n.eventOptions({passive:!0})],gr.prototype,"onTouch",null),hr([n.eventOptions({passive:!0})],gr.prototype,"onHover",null),hr([n.eventOptions({passive:!0})],gr.prototype,"onOut",null),hr([n.eventOptions({passive:!0})],gr.prototype,"onClick",null),o.customElement("ft-tooltip")(gr);class yr extends o.FtLitElement{render(){return e.html`
572
572
  <div class="ft-loader">
573
573
  <div></div>
574
574
  <div></div>