@fluid-topics/ft-tooltip 1.0.57 → 1.0.59

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.
@@ -17,7 +17,7 @@ export declare class FtTooltip extends FtLitElement implements FtTooltipProperti
17
17
  private readonly validPositions;
18
18
  private get validPosition();
19
19
  protected render(): import("lit-html").TemplateResult<1>;
20
- protected update(props: PropertyValues): void;
20
+ protected updated(props: PropertyValues): void;
21
21
  protected contentAvailableCallback(props: PropertyValues): void;
22
22
  private hideDebounce;
23
23
  show(duration?: number): void;
@@ -46,11 +46,11 @@ class FtTooltip extends FtLitElement {
46
46
  </div>
47
47
  `;
48
48
  }
49
- update(props) {
50
- if (props.has("visible") && !this.visible) {
49
+ updated(props) {
50
+ if (props.has("visible") && this.visible) {
51
51
  this.resetTooltipContent();
52
52
  }
53
- super.update(props);
53
+ super.updated(props);
54
54
  }
55
55
  contentAvailableCallback(props) {
56
56
  super.contentAvailableCallback(props);
@@ -159,4 +159,4 @@ const B=Symbol.for(""),G=t=>{if((null==t?void 0:t.r)===B)return null==t?void 0:t
159
159
  </div>
160
160
  </div>
161
161
  </div>
162
- `}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){super.contentAvailableCallback(t),["visible","text"].some((i=>t.has(i)))&&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(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const i=this.tooltip.offsetWidth,o=this.tooltip.offsetHeight,e=(t.offsetHeight-o)/2,s=(t.offsetWidth-i)/2;let n=0,h=0;switch(this.tooltip.style.top="0",this.tooltip.style.left="0",this.validPosition){case"top":h=t.offsetTop-o-this.tooltip.offsetTop,n=t.offsetLeft+s-this.tooltip.offsetLeft;break;case"bottom":h=t.offsetTop+t.offsetHeight-this.tooltip.offsetTop,n=t.offsetLeft+s-this.tooltip.offsetLeft;break;case"left":h=t.offsetTop+e-this.tooltip.offsetTop,n=t.offsetLeft-i-this.tooltip.offsetLeft;break;case"right":h=t.offsetTop+e-this.tooltip.offsetTop,n=t.offsetLeft+t.offsetWidth-this.tooltip.offsetLeft}const r=this.tooltip.style;r.left=n+"px",r.top=h+"px";const l=this.tooltip.getBoundingClientRect();let a=-l.x,p=l.x+l.width-window.innerWidth;r.left=n+Math.round(this.correctOutOfWindowPixels(a,p))+"px";let f=-l.y,y=l.y+l.height-window.innerHeight;r.top=h+Math.round(this.correctOutOfWindowPixels(f,y))+"px",r.maxWidth=`max(${t.offsetWidth}px, ${di.maxWidth})`}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,i){return Math.max(t,Math.min(0,-i))}}$i.elementDefinitions={"ft-typography":ci},$i.styles=ui,vi([e.property()],$i.prototype,"text",void 0),vi([e.property({type:Boolean})],$i.prototype,"manual",void 0),vi([e.property({type:Boolean})],$i.prototype,"inline",void 0),vi([e.property({type:Number})],$i.prototype,"delay",void 0),vi([e.property()],$i.prototype,"position",void 0),vi([e.queryAssignedNodes("",!0)],$i.prototype,"slotNodes",void 0),vi([e.query(".ft-tooltip--container")],$i.prototype,"container",void 0),vi([e.query(".ft-tooltip")],$i.prototype,"tooltip",void 0),vi([e.query(".ft-tooltip--content")],$i.prototype,"tooltipContent",void 0),vi([e.state()],$i.prototype,"visible",void 0),i.customElement("ft-tooltip")($i),t.FtTooltip=$i,t.FtTooltipCssVariables=di,t.styles=ui}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
162
+ `}updated(t){t.has("visible")&&this.visible&&this.resetTooltipContent(),super.updated(t)}contentAvailableCallback(t){super.contentAvailableCallback(t),["visible","text"].some((i=>t.has(i)))&&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(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const i=this.tooltip.offsetWidth,o=this.tooltip.offsetHeight,e=(t.offsetHeight-o)/2,s=(t.offsetWidth-i)/2;let n=0,h=0;switch(this.tooltip.style.top="0",this.tooltip.style.left="0",this.validPosition){case"top":h=t.offsetTop-o-this.tooltip.offsetTop,n=t.offsetLeft+s-this.tooltip.offsetLeft;break;case"bottom":h=t.offsetTop+t.offsetHeight-this.tooltip.offsetTop,n=t.offsetLeft+s-this.tooltip.offsetLeft;break;case"left":h=t.offsetTop+e-this.tooltip.offsetTop,n=t.offsetLeft-i-this.tooltip.offsetLeft;break;case"right":h=t.offsetTop+e-this.tooltip.offsetTop,n=t.offsetLeft+t.offsetWidth-this.tooltip.offsetLeft}const r=this.tooltip.style;r.left=n+"px",r.top=h+"px";const l=this.tooltip.getBoundingClientRect();let a=-l.x,p=l.x+l.width-window.innerWidth;r.left=n+Math.round(this.correctOutOfWindowPixels(a,p))+"px";let f=-l.y,y=l.y+l.height-window.innerHeight;r.top=h+Math.round(this.correctOutOfWindowPixels(f,y))+"px",r.maxWidth=`max(${t.offsetWidth}px, ${di.maxWidth})`}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,i){return Math.max(t,Math.min(0,-i))}}$i.elementDefinitions={"ft-typography":ci},$i.styles=ui,vi([e.property()],$i.prototype,"text",void 0),vi([e.property({type:Boolean})],$i.prototype,"manual",void 0),vi([e.property({type:Boolean})],$i.prototype,"inline",void 0),vi([e.property({type:Number})],$i.prototype,"delay",void 0),vi([e.property()],$i.prototype,"position",void 0),vi([e.queryAssignedNodes("",!0)],$i.prototype,"slotNodes",void 0),vi([e.query(".ft-tooltip--container")],$i.prototype,"container",void 0),vi([e.query(".ft-tooltip")],$i.prototype,"tooltip",void 0),vi([e.query(".ft-tooltip--content")],$i.prototype,"tooltipContent",void 0),vi([e.state()],$i.prototype,"visible",void 0),i.customElement("ft-tooltip")($i),t.FtTooltip=$i,t.FtTooltipCssVariables=di,t.styles=ui}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
@@ -250,7 +250,7 @@ const Ct=Symbol.for(""),Et=t=>{if((null==t?void 0:t.r)===Ct)return null==t?void
250
250
  </div>
251
251
  </div>
252
252
  </div>
253
- `}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){super.contentAvailableCallback(t),["visible","text"].some((i=>t.has(i)))&&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(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const i=this.tooltip.offsetWidth,e=this.tooltip.offsetHeight,o=(t.offsetHeight-e)/2,n=(t.offsetWidth-i)/2;let r=0,s=0;switch(this.tooltip.style.top="0",this.tooltip.style.left="0",this.validPosition){case"top":s=t.offsetTop-e-this.tooltip.offsetTop,r=t.offsetLeft+n-this.tooltip.offsetLeft;break;case"bottom":s=t.offsetTop+t.offsetHeight-this.tooltip.offsetTop,r=t.offsetLeft+n-this.tooltip.offsetLeft;break;case"left":s=t.offsetTop+o-this.tooltip.offsetTop,r=t.offsetLeft-i-this.tooltip.offsetLeft;break;case"right":s=t.offsetTop+o-this.tooltip.offsetTop,r=t.offsetLeft+t.offsetWidth-this.tooltip.offsetLeft}const a=this.tooltip.style;a.left=r+"px",a.top=s+"px";const l=this.tooltip.getBoundingClientRect();let h=-l.x,c=l.x+l.width-window.innerWidth;a.left=r+Math.round(this.correctOutOfWindowPixels(h,c))+"px";let p=-l.y,f=l.y+l.height-window.innerHeight;a.top=s+Math.round(this.correctOutOfWindowPixels(p,f))+"px",a.maxWidth=`max(${t.offsetWidth}px, ${te.maxWidth})`}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,i){return Math.max(t,Math.min(0,-i))}}oe.elementDefinitions={"ft-typography":Yi},oe.styles=ie,ee([o()],oe.prototype,"text",void 0),ee([o({type:Boolean})],oe.prototype,"manual",void 0),ee([o({type:Boolean})],oe.prototype,"inline",void 0),ee([o({type:Number})],oe.prototype,"delay",void 0),ee([o()],oe.prototype,"position",void 0),ee([
253
+ `}updated(t){t.has("visible")&&this.visible&&this.resetTooltipContent(),super.updated(t)}contentAvailableCallback(t){super.contentAvailableCallback(t),["visible","text"].some((i=>t.has(i)))&&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(){this.resetTooltipContent();const t=this.slottedElement;if(this.tooltip&&t){const i=this.tooltip.offsetWidth,e=this.tooltip.offsetHeight,o=(t.offsetHeight-e)/2,n=(t.offsetWidth-i)/2;let r=0,s=0;switch(this.tooltip.style.top="0",this.tooltip.style.left="0",this.validPosition){case"top":s=t.offsetTop-e-this.tooltip.offsetTop,r=t.offsetLeft+n-this.tooltip.offsetLeft;break;case"bottom":s=t.offsetTop+t.offsetHeight-this.tooltip.offsetTop,r=t.offsetLeft+n-this.tooltip.offsetLeft;break;case"left":s=t.offsetTop+o-this.tooltip.offsetTop,r=t.offsetLeft-i-this.tooltip.offsetLeft;break;case"right":s=t.offsetTop+o-this.tooltip.offsetTop,r=t.offsetLeft+t.offsetWidth-this.tooltip.offsetLeft}const a=this.tooltip.style;a.left=r+"px",a.top=s+"px";const l=this.tooltip.getBoundingClientRect();let h=-l.x,c=l.x+l.width-window.innerWidth;a.left=r+Math.round(this.correctOutOfWindowPixels(h,c))+"px";let p=-l.y,f=l.y+l.height-window.innerHeight;a.top=s+Math.round(this.correctOutOfWindowPixels(p,f))+"px",a.maxWidth=`max(${t.offsetWidth}px, ${te.maxWidth})`}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,i){return Math.max(t,Math.min(0,-i))}}oe.elementDefinitions={"ft-typography":Yi},oe.styles=ie,ee([o()],oe.prototype,"text",void 0),ee([o({type:Boolean})],oe.prototype,"manual",void 0),ee([o({type:Boolean})],oe.prototype,"inline",void 0),ee([o({type:Number})],oe.prototype,"delay",void 0),ee([o()],oe.prototype,"position",void 0),ee([
254
254
  /**
255
255
  * @license
256
256
  * Copyright 2017 Google LLC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-tooltip",
3
- "version": "1.0.57",
3
+ "version": "1.0.59",
4
4
  "description": "A simple tooltip component",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,9 +19,9 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-typography": "1.0.57",
23
- "@fluid-topics/ft-wc-utils": "1.0.57",
22
+ "@fluid-topics/ft-typography": "1.0.59",
23
+ "@fluid-topics/ft-wc-utils": "1.0.59",
24
24
  "lit": "2.7.2"
25
25
  },
26
- "gitHead": "f4480503246fb16f02f9e0265e15b7e53e09a23a"
26
+ "gitHead": "9412dc7c29ebc722b1b133bba63b1744f4bfdf60"
27
27
  }