@fluid-topics/ft-tooltip 0.1.6 → 0.1.7
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.
- package/build/ft-tooltip.light.js +158 -0
- package/build/ft-tooltip.min.js +63 -2
- package/package.json +4 -4
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
!function(t,i,o,e){
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2017 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
var s;const n=globalThis.trustedTypes,r=n?n.createPolicy("lit-html",{createHTML:t=>t}):void 0,h=`lit$${(Math.random()+"").slice(9)}$`,l="?"+h,p=`<${l}>`,a=document,f=(t="")=>a.createComment(t),y=t=>null===t||"object"!=typeof t&&"function"!=typeof t,g=Array.isArray,c=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,d=/-->/g,u=/>/g,v=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,$=/'/g,b=/"/g,x=/^(?:script|style|textarea|title)$/i,m=(t=>(i,...o)=>({_$litType$:t,strings:i,values:o}))(1),w=Symbol.for("lit-noChange"),z=Symbol.for("lit-nothing"),k=new WeakMap,A=a.createTreeWalker(a,129,null,!1),_=(t,i)=>{const o=t.length-1,e=[];let s,n=2===i?"<svg>":"",l=c;for(let i=0;i<o;i++){const o=t[i];let r,a,f=-1,y=0;for(;y<o.length&&(l.lastIndex=y,a=l.exec(o),null!==a);)y=l.lastIndex,l===c?"!--"===a[1]?l=d:void 0!==a[1]?l=u:void 0!==a[2]?(x.test(a[2])&&(s=RegExp("</"+a[2],"g")),l=v):void 0!==a[3]&&(l=v):l===v?">"===a[0]?(l=null!=s?s:c,f=-1):void 0===a[1]?f=-2:(f=l.lastIndex-a[2].length,r=a[1],l=void 0===a[3]?v:'"'===a[3]?b:$):l===b||l===$?l=v:l===d||l===u?l=c:(l=v,s=void 0);const g=l===v&&t[i+1].startsWith("/>")?" ":"";n+=l===c?o+p:f>=0?(e.push(r),o.slice(0,f)+"$lit$"+o.slice(f)+h+g):o+h+(-2===f?(e.push(void 0),i):g)}const a=n+(t[o]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==r?r.createHTML(a):a,e]};class N{constructor({strings:t,_$litType$:i},o){let e;this.parts=[];let s=0,r=0;const p=t.length-1,a=this.parts,[y,g]=_(t,i);if(this.el=N.createElement(y,o),A.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=A.nextNode())&&a.length<p;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(h)){const o=g[r++];if(t.push(i),void 0!==o){const t=e.getAttribute(o.toLowerCase()+"$lit$").split(h),i=/([.?@])?(.*)/.exec(o);a.push({type:1,index:s,name:i[2],strings:t,ctor:"."===i[1]?C:"?"===i[1]?M:"@"===i[1]?F:E})}else a.push({type:6,index:s})}for(const i of t)e.removeAttribute(i)}if(x.test(e.tagName)){const t=e.textContent.split(h),i=t.length-1;if(i>0){e.textContent=n?n.emptyScript:"";for(let o=0;o<i;o++)e.append(t[o],f()),A.nextNode(),a.push({type:2,index:++s});e.append(t[i],f())}}}else if(8===e.nodeType)if(e.data===l)a.push({type:2,index:s});else{let t=-1;for(;-1!==(t=e.data.indexOf(h,t+1));)a.push({type:7,index:s}),t+=h.length-1}s++}}static createElement(t,i){const o=a.createElement("template");return o.innerHTML=t,o}}function S(t,i,o=t,e){var s,n,r,h;if(i===w)return i;let l=void 0!==e?null===(s=o._$Cl)||void 0===s?void 0:s[e]:o._$Cu;const p=y(i)?void 0:i._$litDirective$;return(null==l?void 0:l.constructor)!==p&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===p?l=void 0:(l=new p(t),l._$AT(t,o,e)),void 0!==e?(null!==(r=(h=o)._$Cl)&&void 0!==r?r:h._$Cl=[])[e]=l:o._$Cu=l),void 0!==l&&(i=S(t,l._$AS(t,i.values),l,e)),i}class T{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:o},parts:e}=this._$AD,s=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:a).importNode(o,!0);A.currentNode=s;let n=A.nextNode(),r=0,h=0,l=e[0];for(;void 0!==l;){if(r===l.index){let i;2===l.type?i=new O(n,n.nextSibling,this,t):1===l.type?i=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(i=new U(n,this,t)),this.v.push(i),l=e[++h]}r!==(null==l?void 0:l.index)&&(n=A.nextNode(),r++)}return s}m(t){let i=0;for(const o of this.v)void 0!==o&&(void 0!==o.strings?(o._$AI(t,o,i),i+=o.strings.length-2):o._$AI(t[i])),i++}}class O{constructor(t,i,o,e){var s;this.type=2,this._$AH=z,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=o,this.options=e,this._$Cg=null===(s=null==e?void 0:e.isConnected)||void 0===s||s}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),y(t)?t===z||null==t||""===t?(this._$AH!==z&&this._$AR(),this._$AH=z):t!==this._$AH&&t!==w&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):(t=>{var i;return g(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])})(t)?this.A(t):this.$(t)}M(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==z&&y(this._$AH)?this._$AA.nextSibling.data=t:this.S(a.createTextNode(t)),this._$AH=t}T(t){var i;const{values:o,_$litType$:e}=t,s="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=N.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===s)this._$AH.m(o);else{const t=new T(s,this),i=t.p(this.options);t.m(o),this.S(i),this._$AH=t}}_$AC(t){let i=k.get(t.strings);return void 0===i&&k.set(t.strings,i=new N(t)),i}A(t){g(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let o,e=0;for(const s of t)e===i.length?i.push(o=new O(this.M(f()),this.M(f()),this,this.options)):o=i[e],o._$AI(s),e++;e<i.length&&(this._$AR(o&&o._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var o;for(null===(o=this._$AP)||void 0===o||o.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class E{constructor(t,i,o,e,s){this.type=1,this._$AH=z,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=s,o.length>2||""!==o[0]||""!==o[1]?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=z}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,o,e){const s=this.strings;let n=!1;if(void 0===s)t=S(this,t,i,0),n=!y(t)||t!==this._$AH&&t!==w,n&&(this._$AH=t);else{const e=t;let r,h;for(t=s[0],r=0;r<s.length-1;r++)h=S(this,e[o+r],i,r),h===w&&(h=this._$AH[r]),n||(n=!y(h)||h!==this._$AH[r]),h===z?t=z:t!==z&&(t+=(null!=h?h:"")+s[r+1]),this._$AH[r]=h}n&&!e&&this.k(t)}k(t){t===z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class C extends E{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===z?void 0:t}}const I=n?n.emptyScript:"";class M extends E{constructor(){super(...arguments),this.type=4}k(t){t&&t!==z?this.element.setAttribute(this.name,I):this.element.removeAttribute(this.name)}}class F extends E{constructor(t,i,o,e,s){super(t,i,o,e,s),this.type=5}_$AI(t,i=this){var o;if((t=null!==(o=S(this,t,i,0))&&void 0!==o?o:z)===w)return;const e=this._$AH,s=t===z&&e!==z||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==z&&(e===z||s);s&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,o;"function"==typeof this._$AH?this._$AH.call(null!==(o=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==o?o:this.element,t):this._$AH.handleEvent(t)}}class U{constructor(t,i,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t)}}const j=window.litHtmlPolyfillSupport;null==j||j(N,O),(null!==(s=globalThis.litHtmlVersions)&&void 0!==s?s:globalThis.litHtmlVersions=[]).push("2.1.3");
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright 2020 Google LLC
|
|
11
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
+
*/
|
|
13
|
+
const R=t=>({_$litStatic$:t}),Z=new Map,W=(t=>(i,...o)=>{var e;const s=o.length;let n,r;const h=[],l=[];let p,a=0,f=!1;for(;a<s;){for(p=i[a];a<s&&void 0!==(r=o[a],n=null===(e=r)||void 0===e?void 0:e._$litStatic$);)p+=n+i[++a],f=!0;l.push(r),h.push(p),a++}if(a===s&&h.push(i[s]),f){const t=h.join("$$lit$$");void 0===(i=Z.get(t))&&(h.raw=h,Z.set(t,i=h)),o=l}return t(i,...o)})(m);var B,G=function(t,i,o,e){for(var s,n=arguments.length,r=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,o):e,h=t.length-1;h>=0;h--)(s=t[h])&&(r=(n<3?s(r):n>3?s(i,o,r):s(i,o))||r);return n>3&&r&&Object.defineProperty(i,o,r),r};!function(t){t.title="title",t.title_dense="title-dense",t.subtitle1="subtitle1",t.subtitle2="subtitle2",t.body1="body1",t.body2="body2",t.caption="caption",t.breadcrumb="breadcrumb",t.overline="overline",t.button="button"}(B||(B={}));const H=e.FtCssVariable.extend("--ft-typography-font-family",e.designSystemVariables.titleFont),L=e.FtCssVariable.extend("--ft-typography-font-family",e.designSystemVariables.contentFont),K={fontFamily:L,fontSize:e.FtCssVariable.create("--ft-typography-font-size","SIZE","16px"),fontWeight:e.FtCssVariable.create("--ft-typography-font-weight","UNKNOWN","normal"),letterSpacing:e.FtCssVariable.create("--ft-typography-letter-spacing","SIZE","0.496px"),lineHeight:e.FtCssVariable.create("--ft-typography-line-height","SIZE","24px"),textTransform:e.FtCssVariable.create("--ft-typography-text-transform","UNKNOWN","inherit")},D=e.FtCssVariable.extend("--ft-typography-title-font-family",H),q=e.FtCssVariable.extend("--ft-typography-title-font-size",K.fontSize,"20px"),J=e.FtCssVariable.extend("--ft-typography-title-font-weight",K.fontWeight,"normal"),P=e.FtCssVariable.extend("--ft-typography-title-letter-spacing",K.letterSpacing,"0.15px"),Q=e.FtCssVariable.extend("--ft-typography-title-line-height",K.lineHeight,"24px"),V=e.FtCssVariable.extend("--ft-typography-title-text-transform",K.textTransform,"inherit"),X=e.FtCssVariable.extend("--ft-typography-title-dense-font-family",H),Y=e.FtCssVariable.extend("--ft-typography-title-dense-font-size",K.fontSize,"14px"),tt=e.FtCssVariable.extend("--ft-typography-title-dense-font-weight",K.fontWeight,"normal"),it=e.FtCssVariable.extend("--ft-typography-title-dense-letter-spacing",K.letterSpacing,"0.105px"),ot=e.FtCssVariable.extend("--ft-typography-title-dense-line-height",K.lineHeight,"24px"),et=e.FtCssVariable.extend("--ft-typography-title-dense-text-transform",K.textTransform,"inherit"),st=e.FtCssVariable.extend("--ft-typography-subtitle1-font-family",L),nt=e.FtCssVariable.extend("--ft-typography-subtitle1-font-size",K.fontSize,"16px"),rt=e.FtCssVariable.extend("--ft-typography-subtitle1-font-weight",K.fontWeight,"600"),ht=e.FtCssVariable.extend("--ft-typography-subtitle1-letter-spacing",K.letterSpacing,"0.144px"),lt=e.FtCssVariable.extend("--ft-typography-subtitle1-line-height",K.lineHeight,"24px"),pt=e.FtCssVariable.extend("--ft-typography-subtitle1-text-transform",K.textTransform,"inherit"),at=e.FtCssVariable.extend("--ft-typography-subtitle2-font-family",L),ft=e.FtCssVariable.extend("--ft-typography-subtitle2-font-size",K.fontSize,"14px"),yt=e.FtCssVariable.extend("--ft-typography-subtitle2-font-weight",K.fontWeight,"normal"),gt=e.FtCssVariable.extend("--ft-typography-subtitle2-letter-spacing",K.letterSpacing,"0.098px"),ct=e.FtCssVariable.extend("--ft-typography-subtitle2-line-height",K.lineHeight,"24px"),dt=e.FtCssVariable.extend("--ft-typography-subtitle2-text-transform",K.textTransform,"inherit"),ut=e.FtCssVariable.extend("--ft-typography-body1-font-family",L),vt=e.FtCssVariable.extend("--ft-typography-body1-font-size",K.fontSize,"16px"),$t=e.FtCssVariable.extend("--ft-typography-body1-font-weight",K.fontWeight,"normal"),bt=e.FtCssVariable.extend("--ft-typography-body1-letter-spacing",K.letterSpacing,"0.496px"),xt=e.FtCssVariable.extend("--ft-typography-body1-line-height",K.lineHeight,"24px"),mt=e.FtCssVariable.extend("--ft-typography-body1-text-transform",K.textTransform,"inherit"),wt=e.FtCssVariable.extend("--ft-typography-body2-font-family",L),zt=e.FtCssVariable.extend("--ft-typography-body2-font-size",K.fontSize,"14px"),kt=e.FtCssVariable.extend("--ft-typography-body2-font-weight",K.fontWeight,"normal"),At=e.FtCssVariable.extend("--ft-typography-body2-letter-spacing",K.letterSpacing,"0.252px"),_t=e.FtCssVariable.extend("--ft-typography-body2-line-height",K.lineHeight,"20px"),Nt=e.FtCssVariable.extend("--ft-typography-body2-text-transform",K.textTransform,"inherit"),St=e.FtCssVariable.extend("--ft-typography-caption-font-family",L),Tt=e.FtCssVariable.extend("--ft-typography-caption-font-size",K.fontSize,"12px"),Ot=e.FtCssVariable.extend("--ft-typography-caption-font-weight",K.fontWeight,"normal"),Et=e.FtCssVariable.extend("--ft-typography-caption-letter-spacing",K.letterSpacing,"0.396px"),Ct=e.FtCssVariable.extend("--ft-typography-caption-line-height",K.lineHeight,"16px"),It=e.FtCssVariable.extend("--ft-typography-caption-text-transform",K.textTransform,"inherit"),Mt=e.FtCssVariable.extend("--ft-typography-breadcrumb-font-family",L),Ft=e.FtCssVariable.extend("--ft-typography-breadcrumb-font-size",K.fontSize,"10px"),Ut=e.FtCssVariable.extend("--ft-typography-breadcrumb-font-weight",K.fontWeight,"normal"),jt=e.FtCssVariable.extend("--ft-typography-breadcrumb-letter-spacing",K.letterSpacing,"0.33px"),Rt=e.FtCssVariable.extend("--ft-typography-breadcrumb-line-height",K.lineHeight,"16px"),Zt=e.FtCssVariable.extend("--ft-typography-breadcrumb-text-transform",K.textTransform,"inherit"),Wt=e.FtCssVariable.extend("--ft-typography-overline-font-family",L),Bt=e.FtCssVariable.extend("--ft-typography-overline-font-size",K.fontSize,"10px"),Gt=e.FtCssVariable.extend("--ft-typography-overline-font-weight",K.fontWeight,"normal"),Ht=e.FtCssVariable.extend("--ft-typography-overline-letter-spacing",K.letterSpacing,"1.5px"),Lt=e.FtCssVariable.extend("--ft-typography-overline-line-height",K.lineHeight,"16px"),Kt=e.FtCssVariable.extend("--ft-typography-overline-text-transform",K.textTransform,"uppercase"),Dt=e.FtCssVariable.extend("--ft-typography-button-font-family",L),qt=e.FtCssVariable.extend("--ft-typography-button-font-size",K.fontSize,"14px"),Jt=e.FtCssVariable.extend("--ft-typography-button-font-weight",K.fontWeight,"600"),Pt=e.FtCssVariable.extend("--ft-typography-button-letter-spacing",K.letterSpacing,"1.246px"),Qt=e.FtCssVariable.extend("--ft-typography-button-line-height",K.lineHeight,"16px"),Vt=e.FtCssVariable.extend("--ft-typography-button-text-transform",K.textTransform,"uppercase"),Xt=i.css`
|
|
14
|
+
.ft-typography--title {
|
|
15
|
+
font-family: ${D};
|
|
16
|
+
font-size: ${q};
|
|
17
|
+
font-weight: ${J};
|
|
18
|
+
letter-spacing: ${P};
|
|
19
|
+
line-height: ${Q};
|
|
20
|
+
text-transform: ${V};
|
|
21
|
+
}
|
|
22
|
+
`,Yt=i.css`
|
|
23
|
+
.ft-typography--title-dense {
|
|
24
|
+
font-family: ${X};
|
|
25
|
+
font-size: ${Y};
|
|
26
|
+
font-weight: ${tt};
|
|
27
|
+
letter-spacing: ${it};
|
|
28
|
+
line-height: ${ot};
|
|
29
|
+
text-transform: ${et};
|
|
30
|
+
}
|
|
31
|
+
`,ti=i.css`
|
|
32
|
+
.ft-typography--subtitle1 {
|
|
33
|
+
font-family: ${st};
|
|
34
|
+
font-size: ${nt};
|
|
35
|
+
font-weight: ${rt};
|
|
36
|
+
letter-spacing: ${ht};
|
|
37
|
+
line-height: ${lt};
|
|
38
|
+
text-transform: ${pt};
|
|
39
|
+
}
|
|
40
|
+
`,ii=i.css`
|
|
41
|
+
.ft-typography--subtitle2 {
|
|
42
|
+
font-family: ${at};
|
|
43
|
+
font-size: ${ft};
|
|
44
|
+
font-weight: ${yt};
|
|
45
|
+
letter-spacing: ${gt};
|
|
46
|
+
line-height: ${ct};
|
|
47
|
+
text-transform: ${dt};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
`,oi=i.css`
|
|
51
|
+
.ft-typography--body1 {
|
|
52
|
+
font-family: ${ut};
|
|
53
|
+
font-size: ${vt};
|
|
54
|
+
font-weight: ${$t};
|
|
55
|
+
letter-spacing: ${bt};
|
|
56
|
+
line-height: ${xt};
|
|
57
|
+
text-transform: ${mt};
|
|
58
|
+
}
|
|
59
|
+
`,ei=i.css`
|
|
60
|
+
.ft-typography--body2 {
|
|
61
|
+
font-family: ${wt};
|
|
62
|
+
font-size: ${zt};
|
|
63
|
+
font-weight: ${kt};
|
|
64
|
+
letter-spacing: ${At};
|
|
65
|
+
line-height: ${_t};
|
|
66
|
+
text-transform: ${Nt};
|
|
67
|
+
}
|
|
68
|
+
`,si=i.css`
|
|
69
|
+
.ft-typography--caption {
|
|
70
|
+
font-family: ${St};
|
|
71
|
+
font-size: ${Tt};
|
|
72
|
+
font-weight: ${Ot};
|
|
73
|
+
letter-spacing: ${Et};
|
|
74
|
+
line-height: ${Ct};
|
|
75
|
+
text-transform: ${It};
|
|
76
|
+
}
|
|
77
|
+
`,ni=i.css`
|
|
78
|
+
.ft-typography--breadcrumb {
|
|
79
|
+
font-family: ${Mt};
|
|
80
|
+
font-size: ${Ft};
|
|
81
|
+
font-weight: ${Ut};
|
|
82
|
+
letter-spacing: ${jt};
|
|
83
|
+
line-height: ${Rt};
|
|
84
|
+
text-transform: ${Zt};
|
|
85
|
+
}
|
|
86
|
+
`,ri=i.css`
|
|
87
|
+
.ft-typography--overline {
|
|
88
|
+
font-family: ${Wt};
|
|
89
|
+
font-size: ${Bt};
|
|
90
|
+
font-weight: ${Gt};
|
|
91
|
+
letter-spacing: ${Ht};
|
|
92
|
+
line-height: ${Lt};
|
|
93
|
+
text-transform: ${Kt};
|
|
94
|
+
}
|
|
95
|
+
`,hi=i.css`
|
|
96
|
+
.ft-typography--button {
|
|
97
|
+
font-family: ${Dt};
|
|
98
|
+
font-size: ${qt};
|
|
99
|
+
font-weight: ${Jt};
|
|
100
|
+
letter-spacing: ${Pt};
|
|
101
|
+
line-height: ${Qt};
|
|
102
|
+
text-transform: ${Vt};
|
|
103
|
+
}
|
|
104
|
+
`;let li=class extends e.FtLitElement{constructor(){super(...arguments),this.variant=B.body1}getStyles(){return[Xt,Yt,ti,ii,oi,ei,si,ni,ri,hi]}getTemplate(){return this.element?W`
|
|
105
|
+
<${R(this.element)}
|
|
106
|
+
class="ft-typography ft-typography--${this.variant}">
|
|
107
|
+
<slot></slot>
|
|
108
|
+
</${R(this.element)}>
|
|
109
|
+
`:W`
|
|
110
|
+
<slot class="ft-typography ft-typography--${this.variant}"></slot>
|
|
111
|
+
`}};G([o.property()],li.prototype,"element",void 0),G([o.property()],li.prototype,"variant",void 0),li=G([e.customElement("ft-typography")],li);var pi=function(t,i,o,e){for(var s,n=arguments.length,r=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,o):e,h=t.length-1;h>=0;h--)(s=t[h])&&(r=(n<3?s(r):n>3?s(i,o,r):s(i,o))||r);return n>3&&r&&Object.defineProperty(i,o,r),r};const ai={distance:e.FtCssVariable.create("--ft-tooltip-distance","SIZE","4px"),color:e.FtCssVariable.create("--ft-tooltip-color","COLOR","#FFFFFF"),backgroundColor:e.FtCssVariable.create("--ft-tooltip-background-color","COLOR","#666666"),zIndex:e.FtCssVariable.create("--ft-tooltip-z-index","NUMBER","1"),borderRadiusS:e.FtCssVariable.external(e.designSystemVariables.borderRadiusS,"Design system")};t.FtTooltip=class extends e.FtLitElement{constructor(){super(...arguments),this.text="",this.manual=!1,this.inline=!1,this.delay=500,this.position="bottom",this.visible=!1,this.hideDebounce=new e.Debouncer,this.revealDebouncer=new e.Debouncer}getStyles(){return i.css`
|
|
112
|
+
.ft-tooltip--container {
|
|
113
|
+
display: block;
|
|
114
|
+
position: relative;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.ft-tooltip--inline {
|
|
118
|
+
display: inline-block;
|
|
119
|
+
max-width: 100%;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.ft-tooltip {
|
|
123
|
+
position: absolute;
|
|
124
|
+
box-sizing: border-box;
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
width: max-content;
|
|
127
|
+
max-width: 150px;
|
|
128
|
+
text-align: center;
|
|
129
|
+
padding: ${ai.distance};
|
|
130
|
+
z-index: ${ai.zIndex};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.ft-tooltip--content {
|
|
134
|
+
padding: 4px 8px;
|
|
135
|
+
border-radius: ${ai.borderRadiusS};
|
|
136
|
+
background-color: ${ai.backgroundColor};
|
|
137
|
+
color: ${ai.color};
|
|
138
|
+
top: -500px;
|
|
139
|
+
left: -500px;
|
|
140
|
+
position: relative;
|
|
141
|
+
word-break: break-word;
|
|
142
|
+
}
|
|
143
|
+
`}getTemplate(){return i.html`
|
|
144
|
+
<div part="container"
|
|
145
|
+
class="ft-tooltip--container ${this.inline?"ft-tooltip--inline":""}"
|
|
146
|
+
@mouseenter=${this.onHover}
|
|
147
|
+
@mouseleave=${this.onOut}
|
|
148
|
+
@focusin=${this.onHover}
|
|
149
|
+
@focusout=${this.onOut}
|
|
150
|
+
@touchstart=${this.onTouch}>
|
|
151
|
+
<div part="tooltip" class="ft-tooltip ft-tooltip--${this.position}" ?hidden=${!this.visible}>
|
|
152
|
+
<div part="tooltip-content" class="ft-tooltip--content">
|
|
153
|
+
<ft-typography variant="caption">${this.text}</ft-typography>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
<slot></slot>
|
|
157
|
+
</div>
|
|
158
|
+
`}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){t.has("visible")&&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.position){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=t.getBoundingClientRect(),o=(i.height-this.tooltip.clientHeight)/2,e=(i.width-this.tooltip.clientWidth)/2,s=this.tooltip.style;switch(this.position){case"top":s.top=-this.tooltip.clientHeight+"px",s.left=e+"px";break;case"bottom":s.top=i.height+"px",s.left=e+"px";break;case"left":s.top=o+"px",s.left=-this.tooltip.clientWidth+"px";break;case"right":s.top=o+"px",s.left=i.width+"px"}s.maxWidth=Math.max(i.width,150)+"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())}},t.FtTooltip.elementDefinitions={"ft-typography":li},pi([o.property()],t.FtTooltip.prototype,"text",void 0),pi([o.property({type:Boolean})],t.FtTooltip.prototype,"manual",void 0),pi([o.property({type:Boolean})],t.FtTooltip.prototype,"inline",void 0),pi([o.property({type:Number})],t.FtTooltip.prototype,"delay",void 0),pi([o.property()],t.FtTooltip.prototype,"position",void 0),pi([o.queryAssignedNodes("",!0)],t.FtTooltip.prototype,"slotNodes",void 0),pi([o.query(".ft-tooltip--container")],t.FtTooltip.prototype,"container",void 0),pi([o.query("slot")],t.FtTooltip.prototype,"target",void 0),pi([o.query(".ft-tooltip")],t.FtTooltip.prototype,"tooltip",void 0),pi([o.query(".ft-tooltip--content")],t.FtTooltip.prototype,"tooltipContent",void 0),pi([o.state()],t.FtTooltip.prototype,"visible",void 0),t.FtTooltip=pi([e.customElement("ft-tooltip")],t.FtTooltip),t.FtTooltipCssVariables=ai,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.wcUtils);
|
package/build/ft-tooltip.min.js
CHANGED
|
@@ -53,7 +53,21 @@ const ot=({finisher:t,descriptor:i})=>(e,o)=>{var n;if(void 0===o){const o=null!
|
|
|
53
53
|
* @license
|
|
54
54
|
* Copyright 2021 Google LLC
|
|
55
55
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
56
|
-
*/class pt extends(function(t){return class extends t{createRenderRoot(){const t=this.constructor,{registry:i,elementDefinitions:e,shadowRootOptions:o}=t;e&&!i&&(t.registry=new CustomElementRegistry,Object.entries(e).forEach((([i,e])=>t.registry.define(i,e))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:t.registry});return a(n,this.constructor.elementStyles),n}}}(Y)){constructor(){super(),this.constructorName=this.constructor.name,this.proto=this.constructor.prototype}getStyles(){return[]}getTemplate(){return null}render(){let t=this.getStyles();return Array.isArray(t)||(t=[t]),T
|
|
56
|
+
*/class pt extends(function(t){return class extends t{createRenderRoot(){const t=this.constructor,{registry:i,elementDefinitions:e,shadowRootOptions:o}=t;e&&!i&&(t.registry=new CustomElementRegistry,Object.entries(e).forEach((([i,e])=>t.registry.define(i,e))));const n=this.renderOptions.creationScope=this.attachShadow({...o,customElements:t.registry});return a(n,this.constructor.elementStyles),n}}}(Y)){constructor(){super(),this.constructorName=this.constructor.name,this.proto=this.constructor.prototype}getStyles(){return[]}getTemplate(){return null}render(){let t=this.getStyles();return Array.isArray(t)||(t=[t]),T`
|
|
57
|
+
${t.map((t=>T`
|
|
58
|
+
<style>${t}</style>
|
|
59
|
+
`))}
|
|
60
|
+
${this.getTemplate()}
|
|
61
|
+
`}adoptedCallback(){Object.getPrototypeOf(this)!==this.constructorName&&Object.setPrototypeOf(this,this.proto)}updated(t){super.updated(t),setTimeout((()=>this.contentAvailableCallback(t)),0)}contentAvailableCallback(t){}}var ut,ft;s`
|
|
62
|
+
.ft-no-text-select {
|
|
63
|
+
-webkit-touch-callout: none;
|
|
64
|
+
-webkit-user-select: none;
|
|
65
|
+
-khtml-user-select: none;
|
|
66
|
+
-moz-user-select: none;
|
|
67
|
+
-ms-user-select: none;
|
|
68
|
+
user-select: none;
|
|
69
|
+
}
|
|
70
|
+
`,navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(ft=null===(ut=window.safari)||void 0===ut?void 0:ut.pushNotification)||void 0===ft||ft.toString());
|
|
57
71
|
/**
|
|
58
72
|
* @license
|
|
59
73
|
* Copyright 2020 Google LLC
|
|
@@ -157,7 +171,54 @@ const dt=t=>({_$litStatic$:t}),yt=new Map,vt=(t=>(i,...e)=>{var o;const n=e.leng
|
|
|
157
171
|
</${dt(this.element)}>
|
|
158
172
|
`:vt`
|
|
159
173
|
<slot class="ft-typography ft-typography--${this.variant}"></slot>
|
|
160
|
-
`}};bt([et()],Bi.prototype,"element",void 0),bt([et()],Bi.prototype,"variant",void 0),Bi=bt([lt("ft-typography")],Bi);var Pi=function(t,i,e,o){for(var n,r=arguments.length,s=r<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(i,e,s):n(i,e))||s);return r>3&&s&&Object.defineProperty(i,e,s),s};const _i={distance:ht.create("--ft-tooltip-distance","SIZE","4px"),color:ht.create("--ft-tooltip-color","COLOR","#FFFFFF"),backgroundColor:ht.create("--ft-tooltip-background-color","COLOR","#666666"),zIndex:ht.create("--ft-tooltip-z-index","NUMBER","1"),borderRadiusS:ht.external(ct.borderRadiusS,"Design system")};t.FtTooltip=class extends pt{constructor(){super(...arguments),this.text="",this.manual=!1,this.inline=!1,this.delay=500,this.position="bottom",this.visible=!1,this.hideDebounce=new at,this.revealDebouncer=new at}getStyles(){return s
|
|
174
|
+
`}};bt([et()],Bi.prototype,"element",void 0),bt([et()],Bi.prototype,"variant",void 0),Bi=bt([lt("ft-typography")],Bi);var Pi=function(t,i,e,o){for(var n,r=arguments.length,s=r<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(i,e,s):n(i,e))||s);return r>3&&s&&Object.defineProperty(i,e,s),s};const _i={distance:ht.create("--ft-tooltip-distance","SIZE","4px"),color:ht.create("--ft-tooltip-color","COLOR","#FFFFFF"),backgroundColor:ht.create("--ft-tooltip-background-color","COLOR","#666666"),zIndex:ht.create("--ft-tooltip-z-index","NUMBER","1"),borderRadiusS:ht.external(ct.borderRadiusS,"Design system")};t.FtTooltip=class extends pt{constructor(){super(...arguments),this.text="",this.manual=!1,this.inline=!1,this.delay=500,this.position="bottom",this.visible=!1,this.hideDebounce=new at,this.revealDebouncer=new at}getStyles(){return s`
|
|
175
|
+
.ft-tooltip--container {
|
|
176
|
+
display: block;
|
|
177
|
+
position: relative;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.ft-tooltip--inline {
|
|
181
|
+
display: inline-block;
|
|
182
|
+
max-width: 100%;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.ft-tooltip {
|
|
186
|
+
position: absolute;
|
|
187
|
+
box-sizing: border-box;
|
|
188
|
+
overflow: hidden;
|
|
189
|
+
width: max-content;
|
|
190
|
+
max-width: 150px;
|
|
191
|
+
text-align: center;
|
|
192
|
+
padding: ${_i.distance};
|
|
193
|
+
z-index: ${_i.zIndex};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.ft-tooltip--content {
|
|
197
|
+
padding: 4px 8px;
|
|
198
|
+
border-radius: ${_i.borderRadiusS};
|
|
199
|
+
background-color: ${_i.backgroundColor};
|
|
200
|
+
color: ${_i.color};
|
|
201
|
+
top: -500px;
|
|
202
|
+
left: -500px;
|
|
203
|
+
position: relative;
|
|
204
|
+
word-break: break-word;
|
|
205
|
+
}
|
|
206
|
+
`}getTemplate(){return T`
|
|
207
|
+
<div part="container"
|
|
208
|
+
class="ft-tooltip--container ${this.inline?"ft-tooltip--inline":""}"
|
|
209
|
+
@mouseenter=${this.onHover}
|
|
210
|
+
@mouseleave=${this.onOut}
|
|
211
|
+
@focusin=${this.onHover}
|
|
212
|
+
@focusout=${this.onOut}
|
|
213
|
+
@touchstart=${this.onTouch}>
|
|
214
|
+
<div part="tooltip" class="ft-tooltip ft-tooltip--${this.position}" ?hidden=${!this.visible}>
|
|
215
|
+
<div part="tooltip-content" class="ft-tooltip--content">
|
|
216
|
+
<ft-typography variant="caption">${this.text}</ft-typography>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
<slot></slot>
|
|
220
|
+
</div>
|
|
221
|
+
`}update(t){t.has("visible")&&!this.visible&&this.resetTooltipContent(),super.update(t)}contentAvailableCallback(t){t.has("visible")&&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.position){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=t.getBoundingClientRect(),e=(i.height-this.tooltip.clientHeight)/2,o=(i.width-this.tooltip.clientWidth)/2,n=this.tooltip.style;switch(this.position){case"top":n.top=-this.tooltip.clientHeight+"px",n.left=o+"px";break;case"bottom":n.top=i.height+"px",n.left=o+"px";break;case"left":n.top=e+"px",n.left=-this.tooltip.clientWidth+"px";break;case"right":n.top=e+"px",n.left=i.width+"px"}n.maxWidth=Math.max(i.width,150)+"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())}},t.FtTooltip.elementDefinitions={"ft-typography":Bi},Pi([et()],t.FtTooltip.prototype,"text",void 0),Pi([et({type:Boolean})],t.FtTooltip.prototype,"manual",void 0),Pi([et({type:Boolean})],t.FtTooltip.prototype,"inline",void 0),Pi([et({type:Number})],t.FtTooltip.prototype,"delay",void 0),Pi([et()],t.FtTooltip.prototype,"position",void 0),Pi([
|
|
161
222
|
/**
|
|
162
223
|
* @license
|
|
163
224
|
* Copyright 2017 Google LLC
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-tooltip",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
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": "^0.1.
|
|
23
|
-
"@fluid-topics/ft-wc-utils": "^0.1.
|
|
22
|
+
"@fluid-topics/ft-typography": "^0.1.7",
|
|
23
|
+
"@fluid-topics/ft-wc-utils": "^0.1.7",
|
|
24
24
|
"lit": "^2.0.2"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "78397cca67971191c46739cfb6c87481aaa65745"
|
|
27
27
|
}
|