@limetech/lime-elements 40.10.0 → 40.10.1
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/CHANGELOG.md +7 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-hotkey_4.cjs.entry.js +229 -13
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/hotkey/get-hotkey-aria-label.js +14 -0
- package/dist/collection/components/hotkey/hotkey.js +3 -5
- package/dist/collection/components/tooltip/description-registry.js +57 -0
- package/dist/collection/components/tooltip/get-description.js +42 -0
- package/dist/collection/components/tooltip/tooltip.js +53 -11
- package/dist/collection/util/get-focus-target.js +69 -0
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-hotkey_4.entry.js +229 -13
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-1a5478e3.entry.js +1 -0
- package/dist/types/components/hotkey/get-hotkey-aria-label.d.ts +8 -0
- package/dist/types/components/tooltip/description-registry.d.ts +21 -0
- package/dist/types/components/tooltip/get-description.d.ts +13 -0
- package/dist/types/components/tooltip/tooltip.d.ts +11 -3
- package/dist/types/components.d.ts +6 -6
- package/dist/types/util/get-focus-target.d.ts +14 -0
- package/package.json +3 -3
- package/dist/lime-elements/p-a373013f.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as e,H as n,a as i}from"./p-BU9IJqli.js";import{t as r,n as o}from"./p-DjmlD0Mw.js";import{c as a}from"./p-B-tmXAXV.js";import{c as s}from"./p-BrjD-ITe.js";function l(t,e){const n=(null!=t?t:"").trim();if(!n)return{display:"",isGlyph:!1,ariaName:""};if("+"===n)return{display:"+",isGlyph:!1,ariaName:"plus"};const i=n.toLowerCase();switch(i){case"meta":case"win":case"windows":return e?{display:"⌘",isGlyph:!0,ariaName:"Command"}:{display:"⊞ Win",isGlyph:!1,ariaName:"Windows"};case"cmd":case"command":return{display:"⌘",isGlyph:!0,ariaName:"Command"};case"alt":case"option":return e?{display:"⌥",isGlyph:!0,ariaName:"Option"}:{display:"Alt",isGlyph:!1,ariaName:"Alt"};case"shift":return{display:"⇧",isGlyph:!0,ariaName:"Shift"};case"enter":case"return":return{display:"↩",isGlyph:!0,ariaName:"Enter"};case"tab":return{display:"⇥",isGlyph:!0,ariaName:"Tab"};case"delete":case"del":case"backspace":return e?{display:"⌫",isGlyph:!0,ariaName:"Delete"}:"backspace"===i?{display:"Backspace",isGlyph:!1,ariaName:"Backspace"}:{display:"Del",isGlyph:!1,ariaName:"Delete"};case"ctrl":case"control":return e?{display:"⌃",isGlyph:!0,ariaName:"Control"}:{display:"Ctrl",isGlyph:!1,ariaName:"Control"};case"escape":case"esc":return{display:"Esc",isGlyph:!1,ariaName:"Escape"};case"space":case"spacebar":return{display:"␣",isGlyph:!0,ariaName:"Space"};case"arrowup":case"up":return{display:"↑",isGlyph:!0,ariaName:"Up"};case"arrowdown":case"down":return{display:"↓",isGlyph:!0,ariaName:"Down"};case"arrowleft":case"left":return{display:"←",isGlyph:!0,ariaName:"Left"};case"arrowright":case"right":return{display:"→",isGlyph:!0,ariaName:"Right"}}return{display:n,isGlyph:!1,ariaName:n}}function c(t,e){return r(t).map((t=>l(t,e).ariaName)).filter(Boolean).join(" ")}const u=class{constructor(e){t(this,e),this.disabled=!1}componentWillLoad(){this.isApple=a()}render(){const t=r(this.value),i=t.map((t=>l(t,this.isApple))),o=c(this.value,this.isApple);return e(n,{key:"8ffc94c7ac5061743e423e5efb8097b7ea03dc6e","aria-label":o||void 0},i.map((({display:n,isGlyph:i},r)=>e("kbd",{key:`${t[r]}-${r}`,class:i?"is-glyph":void 0},e("span",null,n)))))}};u.style='@charset "UTF-8";kbd{display:inline-block;font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-weight:600;color:rgb(var(--contrast-1100));white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:normal;border-radius:0.125rem;border-style:solid;border-color:rgb(var(--contrast-500));border-width:0 1px 0.1875rem 1px;padding:0.0625rem 0.375rem;margin:0 0.25rem;background-color:rgb(var(--contrast-200));box-shadow:var(--button-shadow-normal), 0 0.625rem 0.375rem -0.5rem rgb(var(--color-black), 0.02), 0 0.025rem 0.5rem 0 rgb(var(--contrast-100)) inset}:host(limel-hotkey){display:flex;align-items:center;justify-content:center;gap:0.25rem}:host(limel-hotkey[disabled]:not([disabled=false])){opacity:0.5}kbd{text-transform:var(--hotkey-text-transform, uppercase);margin:0;font-size:0.75rem;box-shadow:var(--button-shadow-pressed), 0 0.625rem 0.375px -0.5rem rgb(var(--color-black), 0.02), 0 0.025rem 0.5rem 0 rgb(var(--contrast-100)) inset}span{display:inline-block}kbd.is-glyph span{transform:scale(1.2)}';var h="top",f="bottom",d="right",p="left",m="auto",v=[h,f,d,p],b="start",y="end",g="viewport",w="popper",x=v.reduce((function(t,e){return t.concat([e+"-"+b,e+"-"+y])}),[]),O=[].concat(v,[m]).reduce((function(t,e){return t.concat([e,e+"-"+b,e+"-"+y])}),[]),k=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function j(t){return t?(t.nodeName||"").toLowerCase():null}function C(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function M(t){return t instanceof C(t).Element||t instanceof Element}function N(t){return t instanceof C(t).HTMLElement||t instanceof HTMLElement}function G(t){return"undefined"!=typeof ShadowRoot&&(t instanceof C(t).ShadowRoot||t instanceof ShadowRoot)}function D(t){return t.split("-")[0]}var S=Math.max,A=Math.min,B=Math.round;function P(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function L(){return!/^((?!chrome|android).)*safari/i.test(P())}function R(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var i=t.getBoundingClientRect(),r=1,o=1;e&&N(t)&&(r=t.offsetWidth>0&&B(i.width)/t.offsetWidth||1,o=t.offsetHeight>0&&B(i.height)/t.offsetHeight||1);var a=(M(t)?C(t):window).visualViewport,s=!L()&&n,l=(i.left+(s&&a?a.offsetLeft:0))/r,c=(i.top+(s&&a?a.offsetTop:0))/o,u=i.width/r,h=i.height/o;return{width:u,height:h,top:c,right:l+u,bottom:c+h,left:l,x:l,y:c}}function W(t){var e=R(t),n=t.offsetWidth,i=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:i}}function E(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&G(n)){var i=e;do{if(i&&t.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function z(t){return C(t).getComputedStyle(t)}function T(t){return["table","td","th"].indexOf(j(t))>=0}function q(t){return((M(t)?t.ownerDocument:t.document)||window.document).documentElement}function H(t){return"html"===j(t)?t:t.assignedSlot||t.parentNode||(G(t)?t.host:null)||q(t)}function $(t){return N(t)&&"fixed"!==z(t).position?t.offsetParent:null}function I(t){for(var e=C(t),n=$(t);n&&T(n)&&"static"===z(n).position;)n=$(n);return n&&("html"===j(n)||"body"===j(n)&&"static"===z(n).position)?e:n||function(t){var e=/firefox/i.test(P());if(/Trident/i.test(P())&&N(t)&&"fixed"===z(t).position)return null;var n=H(t);for(G(n)&&(n=n.host);N(n)&&["html","body"].indexOf(j(n))<0;){var i=z(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||e&&"filter"===i.willChange||e&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(t)||e}function F(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function _(t,e,n){return S(t,A(e,n))}function V(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function U(t,e){return e.reduce((function(e,n){return e[n]=t,e}),{})}function X(t){return t.split("-")[1]}var J={top:"auto",right:"auto",bottom:"auto",left:"auto"};function K(t){var e,n=t.popper,i=t.popperRect,r=t.placement,o=t.variation,a=t.offsets,s=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,m=t.isFixed,v=a.x,b=void 0===v?0:v,g=a.y,w=void 0===g?0:g,x="function"==typeof u?u({x:b,y:w}):{x:b,y:w};b=x.x,w=x.y;var O=a.hasOwnProperty("x"),k=a.hasOwnProperty("y"),j=p,M=h,N=window;if(c){var G=I(n),D="clientHeight",S="clientWidth";G===C(n)&&"static"!==z(G=q(n)).position&&"absolute"===s&&(D="scrollHeight",S="scrollWidth"),(r===h||(r===p||r===d)&&o===y)&&(M=f,w-=(m&&G===N&&N.visualViewport?N.visualViewport.height:G[D])-i.height,w*=l?1:-1),r!==p&&(r!==h&&r!==f||o!==y)||(j=d,b-=(m&&G===N&&N.visualViewport?N.visualViewport.width:G[S])-i.width,b*=l?1:-1)}var A,P=Object.assign({position:s},c&&J),L=!0===u?function(t,e){var n=t.y,i=e.devicePixelRatio||1;return{x:B(t.x*i)/i||0,y:B(n*i)/i||0}}({x:b,y:w},C(n)):{x:b,y:w};return b=L.x,w=L.y,Object.assign({},P,l?((A={})[M]=k?"0":"",A[j]=O?"0":"",A.transform=(N.devicePixelRatio||1)<=1?"translate("+b+"px, "+w+"px)":"translate3d("+b+"px, "+w+"px, 0)",A):((e={})[M]=k?w+"px":"",e[j]=O?b+"px":"",e.transform="",e))}var Q={passive:!0},Y={left:"right",right:"left",bottom:"top",top:"bottom"};function Z(t){return t.replace(/left|right|bottom|top/g,(function(t){return Y[t]}))}var tt={start:"end",end:"start"};function et(t){return t.replace(/start|end/g,(function(t){return tt[t]}))}function nt(t){var e=C(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function it(t){return R(q(t)).left+nt(t).scrollLeft}function rt(t){var e=z(t);return/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function ot(t){return["html","body","#document"].indexOf(j(t))>=0?t.ownerDocument.body:N(t)&&rt(t)?t:ot(H(t))}function at(t,e){var n;void 0===e&&(e=[]);var i=ot(t),r=i===(null==(n=t.ownerDocument)?void 0:n.body),o=C(i),a=r?[o].concat(o.visualViewport||[],rt(i)?i:[]):i,s=e.concat(a);return r?s:s.concat(at(H(a)))}function st(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function lt(t,e,n){return e===g?st(function(t,e){var n=C(t),i=q(t),r=n.visualViewport,o=i.clientWidth,a=i.clientHeight,s=0,l=0;if(r){o=r.width,a=r.height;var c=L();(c||!c&&"fixed"===e)&&(s=r.offsetLeft,l=r.offsetTop)}return{width:o,height:a,x:s+it(t),y:l}}(t,n)):M(e)?function(t,e){var n=R(t,!1,"fixed"===e);return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}(e,n):st(function(t){var e,n=q(t),i=nt(t),r=null==(e=t.ownerDocument)?void 0:e.body,o=S(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=S(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),s=-i.scrollLeft+it(t),l=-i.scrollTop;return"rtl"===z(r||n).direction&&(s+=S(n.clientWidth,r?r.clientWidth:0)-o),{width:o,height:a,x:s,y:l}}(q(t)))}function ct(t){var e,n=t.reference,i=t.element,r=t.placement,o=r?D(r):null,a=r?X(r):null,s=n.x+n.width/2-i.width/2,l=n.y+n.height/2-i.height/2;switch(o){case h:e={x:s,y:n.y-i.height};break;case f:e={x:s,y:n.y+n.height};break;case d:e={x:n.x+n.width,y:l};break;case p:e={x:n.x-i.width,y:l};break;default:e={x:n.x,y:n.y}}var c=o?F(o):null;if(null!=c){var u="y"===c?"height":"width";switch(a){case b:e[c]=e[c]-(n[u]/2-i[u]/2);break;case y:e[c]=e[c]+(n[u]/2-i[u]/2)}}return e}function ut(t,e){void 0===e&&(e={});var n=e.placement,i=void 0===n?t.placement:n,r=e.strategy,o=void 0===r?t.strategy:r,a=e.boundary,s=void 0===a?"clippingParents":a,l=e.rootBoundary,c=void 0===l?g:l,u=e.elementContext,p=void 0===u?w:u,m=e.altBoundary,b=void 0!==m&&m,y=e.padding,x=void 0===y?0:y,O=V("number"!=typeof x?x:U(x,v)),k=t.rects.popper,C=t.elements[b?p===w?"reference":w:p],G=function(t,e,n,i){var r="clippingParents"===e?function(t){var e=at(H(t)),n=["absolute","fixed"].indexOf(z(t).position)>=0&&N(t)?I(t):t;return M(n)?e.filter((function(t){return M(t)&&E(t,n)&&"body"!==j(t)})):[]}(t):[].concat(e),o=[].concat(r,[n]),a=o.reduce((function(e,n){var r=lt(t,n,i);return e.top=S(r.top,e.top),e.right=A(r.right,e.right),e.bottom=A(r.bottom,e.bottom),e.left=S(r.left,e.left),e}),lt(t,o[0],i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(M(C)?C:C.contextElement||q(t.elements.popper),s,c,o),D=R(t.elements.reference),B=ct({reference:D,element:k,placement:i}),P=st(Object.assign({},k,B)),L=p===w?P:D,W={top:G.top-L.top+O.top,bottom:L.bottom-G.bottom+O.bottom,left:G.left-L.left+O.left,right:L.right-G.right+O.right},T=t.modifiersData.offset;if(p===w&&T){var $=T[i];Object.keys(W).forEach((function(t){var e=[d,f].indexOf(t)>=0?1:-1,n=[h,f].indexOf(t)>=0?"y":"x";W[t]+=$[n]*e}))}return W}function ht(t,e){void 0===e&&(e={});var n=e.boundary,i=e.rootBoundary,r=e.padding,o=e.flipVariations,a=e.allowedAutoPlacements,s=void 0===a?O:a,l=X(e.placement),c=l?o?x:x.filter((function(t){return X(t)===l})):v,u=c.filter((function(t){return s.indexOf(t)>=0}));0===u.length&&(u=c);var h=u.reduce((function(e,o){return e[o]=ut(t,{placement:o,boundary:n,rootBoundary:i,padding:r})[D(o)],e}),{});return Object.keys(h).sort((function(t,e){return h[t]-h[e]}))}var ft={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,i=t.name;if(!e.modifiersData[i]._skip){for(var r=n.mainAxis,o=void 0===r||r,a=n.altAxis,s=void 0===a||a,l=n.fallbackPlacements,c=n.padding,u=n.boundary,v=n.rootBoundary,y=n.altBoundary,g=n.flipVariations,w=void 0===g||g,x=n.allowedAutoPlacements,O=e.options.placement,k=D(O),j=l||(k!==O&&w?function(t){if(D(t)===m)return[];var e=Z(t);return[et(t),e,et(e)]}(O):[Z(O)]),C=[O].concat(j).reduce((function(t,n){return t.concat(D(n)===m?ht(e,{placement:n,boundary:u,rootBoundary:v,padding:c,flipVariations:w,allowedAutoPlacements:x}):n)}),[]),M=e.rects.reference,N=e.rects.popper,G=new Map,S=!0,A=C[0],B=0;B<C.length;B++){var P=C[B],L=D(P),R=X(P)===b,W=[h,f].indexOf(L)>=0,E=W?"width":"height",z=ut(e,{placement:P,boundary:u,rootBoundary:v,altBoundary:y,padding:c}),T=W?R?d:p:R?f:h;M[E]>N[E]&&(T=Z(T));var q=Z(T),H=[];if(o&&H.push(z[L]<=0),s&&H.push(z[T]<=0,z[q]<=0),H.every((function(t){return t}))){A=P,S=!1;break}G.set(P,H)}if(S)for(var $=function(t){var e=C.find((function(e){var n=G.get(e);if(n)return n.slice(0,t).every((function(t){return t}))}));if(e)return A=e,"break"},I=w?3:1;I>0&&"break"!==$(I);I--);e.placement!==A&&(e.modifiersData[i]._skip=!0,e.placement=A,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function dt(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function pt(t){return[h,d,f,p].some((function(e){return t[e]>=0}))}function mt(t,e,n){void 0===n&&(n=!1);var i,r,o=N(e),a=N(e)&&function(t){var e=t.getBoundingClientRect(),n=B(e.width)/t.offsetWidth||1,i=B(e.height)/t.offsetHeight||1;return 1!==n||1!==i}(e),s=q(e),l=R(t,a,n),c={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(o||!o&&!n)&&(("body"!==j(e)||rt(s))&&(c=(i=e)!==C(i)&&N(i)?{scrollLeft:(r=i).scrollLeft,scrollTop:r.scrollTop}:nt(i)),N(e)?((u=R(e,!0)).x+=e.clientLeft,u.y+=e.clientTop):s&&(u.x=it(s))),{x:l.left+c.scrollLeft-u.x,y:l.top+c.scrollTop-u.y,width:l.width,height:l.height}}function vt(t){var e=new Map,n=new Set,i=[];function r(t){n.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!n.has(t)){var i=e.get(t);i&&r(i)}})),i.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){n.has(t.name)||r(t)})),i}var bt={placement:"bottom",modifiers:[],strategy:"absolute"};function yt(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function gt(t){void 0===t&&(t={});var e=t.defaultModifiers,n=void 0===e?[]:e,i=t.defaultOptions,r=void 0===i?bt:i;return function(t,e,i){void 0===i&&(i=r);var o,a,s={placement:"bottom",orderedModifiers:[],options:Object.assign({},bt,r),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},l=[],c=!1,u={state:s,setOptions:function(i){var o="function"==typeof i?i(s.options):i;h(),s.options=Object.assign({},r,s.options,o),s.scrollParents={reference:M(t)?at(t):t.contextElement?at(t.contextElement):[],popper:at(e)};var a,c,f=function(t){var e=vt(t);return k.reduce((function(t,n){return t.concat(e.filter((function(t){return t.phase===n})))}),[])}((a=[].concat(n,s.options.modifiers),c=a.reduce((function(t,e){var n=t[e.name];return t[e.name]=n?Object.assign({},n,e,{options:Object.assign({},n.options,e.options),data:Object.assign({},n.data,e.data)}):e,t}),{}),Object.keys(c).map((function(t){return c[t]}))));return s.orderedModifiers=f.filter((function(t){return t.enabled})),s.orderedModifiers.forEach((function(t){var e=t.options,n=t.effect;if("function"==typeof n){var i=n({state:s,name:t.name,instance:u,options:void 0===e?{}:e});l.push(i||function(){})}})),u.update()},forceUpdate:function(){if(!c){var t=s.elements,e=t.reference,n=t.popper;if(yt(e,n)){s.rects={reference:mt(e,I(n),"fixed"===s.options.strategy),popper:W(n)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach((function(t){return s.modifiersData[t.name]=Object.assign({},t.data)}));for(var i=0;i<s.orderedModifiers.length;i++)if(!0!==s.reset){var r=s.orderedModifiers[i],o=r.fn,a=r.options;"function"==typeof o&&(s=o({state:s,options:void 0===a?{}:a,name:r.name,instance:u})||s)}else s.reset=!1,i=-1}}},update:(o=function(){return new Promise((function(t){u.forceUpdate(),t(s)}))},function(){return a||(a=new Promise((function(t){Promise.resolve().then((function(){a=void 0,t(o())}))}))),a}),destroy:function(){h(),c=!0}};if(!yt(t,e))return u;function h(){l.forEach((function(t){return t()})),l=[]}return u.setOptions(i).then((function(t){!c&&i.onFirstUpdate&&i.onFirstUpdate(t)})),u}}var wt=gt({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,n=t.instance,i=t.options,r=i.scroll,o=void 0===r||r,a=i.resize,s=void 0===a||a,l=C(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",n.update,Q)})),s&&l.addEventListener("resize",n.update,Q),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",n.update,Q)})),s&&l.removeEventListener("resize",n.update,Q)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state;e.modifiersData[t.name]=ct({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,n=t.options,i=n.gpuAcceleration,r=void 0===i||i,o=n.adaptive,a=void 0===o||o,s=n.roundOffsets,l=void 0===s||s,c={placement:D(e.placement),variation:X(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,K(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,K(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},r=e.elements[t];N(r)&&j(r)&&(Object.assign(r.style,n),Object.keys(i).forEach((function(t){var e=i[t];!1===e?r.removeAttribute(t):r.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach((function(t){var i=e.elements[t],r=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce((function(t,e){return t[e]="",t}),{});N(i)&&j(i)&&(Object.assign(i.style,o),Object.keys(r).forEach((function(t){i.removeAttribute(t)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,n=t.name,i=t.options.offset,r=void 0===i?[0,0]:i,o=O.reduce((function(t,n){return t[n]=function(t,e,n){var i=D(t),r=[p,h].indexOf(i)>=0?-1:1,o="function"==typeof n?n(Object.assign({},e,{placement:t})):n,a=o[0],s=o[1];return a=a||0,s=(s||0)*r,[p,d].indexOf(i)>=0?{x:s,y:a}:{x:a,y:s}}(n,e.rects,r),t}),{}),a=o[e.placement],s=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=a.x,e.modifiersData.popperOffsets.y+=s),e.modifiersData[n]=o}},ft,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,i=t.name,r=n.mainAxis,o=void 0===r||r,a=n.altAxis,s=void 0!==a&&a,l=n.tether,c=void 0===l||l,u=n.tetherOffset,m=void 0===u?0:u,v=ut(e,{boundary:n.boundary,rootBoundary:n.rootBoundary,padding:n.padding,altBoundary:n.altBoundary}),y=D(e.placement),g=X(e.placement),w=!g,x=F(y),O="x"===x?"y":"x",k=e.modifiersData.popperOffsets,j=e.rects.reference,C=e.rects.popper,M="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,N="number"==typeof M?{mainAxis:M,altAxis:M}:Object.assign({mainAxis:0,altAxis:0},M),G=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,B={x:0,y:0};if(k){if(o){var P,L="y"===x?h:p,R="y"===x?f:d,E="y"===x?"height":"width",z=k[x],T=z+v[L],q=z-v[R],H=c?-C[E]/2:0,$=g===b?j[E]:C[E],V=g===b?-C[E]:-j[E],U=e.elements.arrow,J=c&&U?W(U):{width:0,height:0},K=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},Q=K[L],Y=K[R],Z=_(0,j[E],J[E]),tt=w?j[E]/2-H-Z-Q-N.mainAxis:$-Z-Q-N.mainAxis,et=w?-j[E]/2+H+Z+Y+N.mainAxis:V+Z+Y+N.mainAxis,nt=e.elements.arrow&&I(e.elements.arrow),it=null!=(P=null==G?void 0:G[x])?P:0,rt=z+et-it,ot=_(c?A(T,z+tt-it-(nt?"y"===x?nt.clientTop||0:nt.clientLeft||0:0)):T,z,c?S(q,rt):q);k[x]=ot,B[x]=ot-z}if(s){var at,st=k[O],lt="y"===O?"height":"width",ct=st+v["x"===x?h:p],ht=st-v["x"===x?f:d],ft=-1!==[h,p].indexOf(y),dt=null!=(at=null==G?void 0:G[O])?at:0,pt=ft?ct:st-j[lt]-C[lt]-dt+N.altAxis,mt=ft?st+j[lt]+C[lt]-dt-N.altAxis:ht,vt=c&&ft?function(t,e,n){var i=_(t,e,n);return i>n?n:i}(pt,st,mt):_(c?pt:ct,st,c?mt:ht);k[O]=vt,B[O]=vt-st}e.modifiersData[i]=B}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,i=t.name,r=t.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,s=D(n.placement),l=F(s),c=[p,d].indexOf(s)>=0?"height":"width";if(o&&a){var u=function(t,e){return V("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:U(t,v))}(r.padding,n),m=W(o),b="y"===l?h:p,y="y"===l?f:d,g=n.rects.reference[c]+n.rects.reference[l]-a[l]-n.rects.popper[c],w=a[l]-n.rects.reference[l],x=I(o),O=x?"y"===l?x.clientHeight||0:x.clientWidth||0:0,k=O/2-m[c]/2+(g/2-w/2),j=_(u[b],k,O-m[c]-u[y]);n.modifiersData[i]=((e={})[l]=j,e.centerOffset=j-k,e)}},effect:function(t){var e=t.state,n=t.options.element,i=void 0===n?"[data-popper-arrow]":n;null!=i&&("string"!=typeof i||(i=e.elements.popper.querySelector(i)))&&E(e.elements.popper,i)&&(e.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,i=e.rects.reference,r=e.rects.popper,o=e.modifiersData.preventOverflow,a=ut(e,{elementContext:"reference"}),s=ut(e,{altBoundary:!0}),l=dt(a,i),c=dt(s,r,o),u=pt(l),h=pt(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":h})}}]});const xt="is-visible",Ot="is-hiding",kt=class{get anchorElement(){return this.anchor||this.host}constructor(e){t(this,e),this.openDirection="bottom",this.position="absolute",this.containerStyle={},this.inheritParentWidth=!1,this.visible=!1,this.anchor=null,this.loaded=!1,this.writtenStyles={},this.scheduledRestyle=null,this.parents=new WeakMap}disconnectedCallback(){this.removeContainer(),this.destroyPopper(),this.observer=null,this.container=null}connectedCallback(){this.loaded&&this.visible&&this.init()}componentDidLoad(){this.loaded=!0,this.connectedCallback()}init(){this.host.isConnected&&(this.createContainer(),this.hideContainer(),this.attachContainer(),this.styleContainer(),this.visible&&(this.createPopper(),this.showContainer()))}render(){return e("slot",{key:"f4db0b146b4cd851a9837bf10dc7d331cd5a9dce"})}onVisible(){this.container||!this.visible?this.visible?(this.styleContainer(),this.createPopper(),requestAnimationFrame((()=>{this.showContainer()}))):this.animateHideAndCleanup():this.init()}createContainer(){const t=this.host.shadowRoot.querySelector("slot"),e=t.assignedElements&&t.assignedElements()||[];this.writtenStyles={},this.container=document.createElement("div"),this.container.setAttribute("id",this.containerId),this.container.setAttribute("class","limel-portal--container"),Object.assign(this.container,{portalSource:this.host});for(const t of e)this.parents.set(t,t.parentElement),this.container.append(t)}attachContainer(){this.getParent().append(this.container)}removeContainer(){if(this.container){for(const t of[...this.container.children]){const e=this.parents.get(t);e&&e.append(t)}this.container.remove()}}hideContainer(){this.container&&this.container.classList.remove(xt)}showContainer(){this.container.classList.add(xt)}animateHideAndCleanup(){this.container&&(this.container.classList.add(Ot),this.styleContainer(),setTimeout((()=>{this.container&&(this.container.classList.remove(Ot),this.visible||(this.container.classList.remove(xt),this.destroyPopper()))}),300))}styleContainer(){const t=this.host.getBoundingClientRect();this.setContainerWidth(t),this.setContainerHeight(t),this.setContainerStyles()}setContainerWidth(t){if(!this.inheritParentWidth)return;const e=t.width>0?t.width:this.getContentWidth(this.container);this.setContainerStyle("width",`${e}px`)}getContentWidth(t){if(!t)return null;const e=t.getBoundingClientRect().width;if(0!==e)return e;const n=t.querySelector("*");return this.getContentWidth(n)}setContainerStyles(){for(const[t,e]of Object.entries(this.containerStyle))this.container.style[t]=e}setContainerStyle(t,e){this.writtenStyles[t]!==e&&(this.writtenStyles[t]=e,this.container.style[t]=e)}createPopper(){this.destroyPopper();const t=this.createPopperConfig();this.popperInstance=wt(this.anchorElement,this.container,t),this.observeResize()}destroyPopper(){var t,e;null===(t=this.observer)||void 0===t||t.disconnect(),this.cancelScheduledRestyle(),null===(e=this.popperInstance)||void 0===e||e.destroy(),this.popperInstance=null}observeResize(){var t;"ResizeObserver"in window&&(null!==(t=this.observer)&&void 0!==t||(this.observer=new ResizeObserver((()=>{this.scheduleRestyle()}))),this.observer.observe(this.container),this.observer.observe(this.anchorElement))}scheduleRestyle(){null===this.scheduledRestyle&&(this.scheduledRestyle=requestAnimationFrame((()=>{this.scheduledRestyle=null,this.popperInstance&&(this.styleContainer(),this.popperInstance.update())})))}cancelScheduledRestyle(){null!==this.scheduledRestyle&&(cancelAnimationFrame(this.scheduledRestyle),this.scheduledRestyle=null)}createPopperConfig(){const t=this.getPlacement(this.openDirection),e=this.getFlipPlacement(this.openDirection);return{strategy:this.position,placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:[e]}}]}}getPlacement(t){return{"left-start":"left-start",left:"left","left-end":"left-end","right-start":"right-start",right:"right","right-end":"right-end","top-start":"top-start",top:"top","top-end":"top-end","bottom-start":"bottom-start",bottom:"bottom","bottom-end":"bottom-end"}[t]}getFlipPlacement(t){return{"left-start":"right-start",left:"right","left-end":"right-end","right-start":"left-start",right:"left","right-end":"left-end","top-start":"bottom-start",top:"bottom","top-end":"bottom-end","bottom-start":"top-start",bottom:"top","bottom-end":"top-end"}[t]}setContainerHeight(t){const e=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0),n=Math.max(t.top,0),i=Math.max(e-t.bottom,0),r=Math.max(0,Math.round(Math.max(n,i)-16));this.setContainerStyle("maxHeight",`${r}px`)}getParent(){let t=this.anchorElement;for(;t;){const e=t.closest(".limel-portal--parent");if(e)return e;t=t.getRootNode().host}return document.body}get host(){return i(this)}static get watchers(){return{visible:[{onVisible:0}]}}};kt.style=":host(limel-portal){display:block;position:absolute;top:0;bottom:0;width:100%;pointer-events:none}:host([hidden]){display:none}slot{display:none}";const jt=new WeakMap;function Ct(t){return t.replaceAll(/\s+/g," ").trim().toLowerCase()}const Mt=["button",'input:not([type="hidden"])',"select","textarea"],Nt=["a[href]",...Mt.map((t=>`${t}:not([disabled])`)),"summary",'[contenteditable]:not([contenteditable="false"])',"[tabindex]"].map((t=>`${t}:not([tabindex="-1"])`)).join(", "),Gt=Mt.map((t=>`${t}[disabled]:not([tabindex="-1"])`)).join(", ");async function Dt(t,e){return function(t){var e;return!(null===(e=t.shadowRoot)||void 0===e?void 0:e.delegatesFocus)&&t.matches(Nt)}(t)?t:(function(t,e){!e.disabled&&t.matches(Gt)&&(e.disabled=t)}(t,e),async function(t,e){(function(t){return"componentOnReady"in t&&"function"==typeof t.componentOnReady})(t)&&await t.componentOnReady();const n=t.shadowRoot?await St(t.shadowRoot.children,e):void 0;return null!=n?n:St(t.children,e)}(t,e))}async function St(t,e){for(const n of t){if("limel-tooltip"===n.localName)continue;const t=await Dt(n,e);if(t)return t}}class At{constructor(t,e,n=500){this.timerHandle=null,this.showCallback=t,this.hideCallback=e,this.delayForShowing=n}showAfterDelay(){this.timerHandle||(this.timerHandle=setTimeout(this.showCallback,this.delayForShowing))}hide(){clearTimeout(this.timerHandle),this.timerHandle=null,this.hideCallback()}}const Bt=class{constructor(e){t(this,e),this.maxlength=50,this.openDirection="top",this.latestUpdate=0,this.showTooltip=()=>{this.tooltipTimer.showAfterDelay()},this.hideTooltip=()=>{this.tooltipTimer.hide()},this.portalId=s(),this.tooltipTimer=new At((()=>this.open=!0),(()=>this.open=!1))}async connectedCallback(){this.ownerElement=function(t,e){let n=e;do{n=n.parentNode}while(n&&n.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&n.nodeType!==Node.DOCUMENT_NODE);return null==n?void 0:n.getElementById(t)}(this.elementId,this.host),this.addListeners(),await this.updateDescription()}disconnectedCallback(){this.removeListeners(),this.latestUpdate++,this.restoreDescription()}async watchDescription(){await this.updateDescription()}render(){const t=getComputedStyle(this.host).getPropertyValue("--tooltip-z-index");return e("div",{key:"f77ad0d2453d4abda766785d0ccfe96154df71bb",class:"trigger-anchor"},e("limel-portal",{key:"e7f314f76039381ebe5c3add9e675a53650ad8f1",openDirection:this.openDirection,visible:this.open,containerId:this.portalId,containerStyle:{"z-index":t,"pointer-events":"none"},anchor:this.ownerElement},e("limel-tooltip-content",{key:"afbd8bf04d7070fa8afe22f14496c2c24cdf222e",label:this.label,helperLabel:this.helperLabel,hotkey:this.hotkey,maxlength:this.maxlength,role:"tooltip","aria-hidden":!this.open})))}async updateDescription(){if(!this.ownerElement)return;const t=++this.latestUpdate,e=await async function(t){var e,n;const i={};return null!==(n=null!==(e=await Dt(t,i))&&void 0!==e?e:i.disabled)&&void 0!==n?n:t}(this.ownerElement);if(!this.host.isConnected||t!==this.latestUpdate)return;e!==this.describedElement&&(this.restoreDescription(),this.describedElement=e);const n=function(t,e,n,i){const r=new Set(function(t){var e;const n=null===(e=t.getAttribute("aria-label"))||void 0===e?void 0:e.trim();if(n)return[n];const i=[...t.querySelectorAll("[aria-label]")];return[t.textContent,...[...t.children].map((t=>t.textContent)),...i.map((t=>t.getAttribute("aria-label")))].filter(Boolean)}(t).map(Ct)),s=[e,n].filter((t=>t&&!r.has(Ct(t))));return s.push(function(t){const e=o(t);return e?c(e,a()):void 0}(i)),s.filter(Boolean).join(". ")}(e,this.label,this.helperLabel,this.hotkey);n?function(t,e,n){let i=jt.get(t);i||(i={original:t.getAttribute("aria-description"),texts:new Map},jt.set(t,i)),i.texts.delete(e),i.texts.set(e,n),t.setAttribute("aria-description",n)}(e,this,n):this.restoreDescription()}restoreDescription(){this.describedElement&&function(t,e){const n=jt.get(t),i=null==n?void 0:n.texts.get(e);if(!n||void 0===i)return;n.texts.delete(e);const r=t.getAttribute("aria-description")===i,o=[...n.texts.values()].at(-1);void 0===o?(jt.delete(t),r&&(null!==n.original?t.setAttribute("aria-description",n.original):t.removeAttribute("aria-description"))):r&&t.setAttribute("aria-description",o)}(this.describedElement,this),this.describedElement=void 0}addListeners(){var t,e,n,i;null===(t=this.ownerElement)||void 0===t||t.addEventListener("mouseover",this.showTooltip),null===(e=this.ownerElement)||void 0===e||e.addEventListener("mouseout",this.hideTooltip),null===(n=this.ownerElement)||void 0===n||n.addEventListener("focus",this.showTooltip),null===(i=this.ownerElement)||void 0===i||i.addEventListener("blur",this.hideTooltip)}removeListeners(){var t,e,n,i;null===(t=this.ownerElement)||void 0===t||t.removeEventListener("mouseover",this.showTooltip),null===(e=this.ownerElement)||void 0===e||e.removeEventListener("mouseout",this.hideTooltip),null===(n=this.ownerElement)||void 0===n||n.removeEventListener("focus",this.showTooltip),null===(i=this.ownerElement)||void 0===i||i.removeEventListener("blur",this.hideTooltip)}get host(){return i(this)}static get watchers(){return{label:[{watchDescription:0}],helperLabel:[{watchDescription:0}],hotkey:[{watchDescription:0}]}}};Bt.style=":host(limel-tooltip){position:absolute;pointer-events:none}";const Pt=class{constructor(e){t(this,e)}render(){let t=!1;return this.helperLabel&&this.maxlength&&(t=this.label.length+this.helperLabel.length>this.maxlength),e(n,{key:"63d36a0e0f1fb0e4eb94c5c216c80299d82f63b2",class:{"has-column-layout":t},style:this.maxlength?{"--tooltip-max-width-of-text":`${this.maxlength}ch`}:void 0},e("div",{key:"6d4ecf58b8854edeece92a53065816292a2a39b9",class:"label"},this.label),this.renderHelperLabel(),this.renderHotkey())}renderHelperLabel(){if(this.helperLabel)return e("div",{class:"helper-label"},this.helperLabel)}renderHotkey(){if(!this.hotkey)return;const t=o(this.hotkey);return t?e("limel-hotkey",{value:t}):void 0}};Pt.style=":host(limel-tooltip-content){box-sizing:border-box;display:flex;align-items:center;gap:0.5rem 1rem;border-radius:0.25rem;padding:0.25rem 0.5rem;font-size:var(--limel-theme-default-font-size);line-height:normal;background-color:rgb(var(--contrast-1300));box-shadow:var(--shadow-depth-16), var(--shadow-brighten-edges-inside)}:host(.has-column-layout){flex-direction:column;align-items:flex-start;padding:0.5rem;max-width:min(var(--tooltip-max-width-of-text), 80vw)}:host(.has-column-layout) .label,:host(.has-column-layout) .helper-label{flex-grow:1}.label,.helper-label{min-width:0;min-height:0}.label{color:rgb(var(--contrast-200))}.helper-label{color:rgb(var(--contrast-800))}limel-hotkey{margin-right:-0.25rem}";export{u as limel_hotkey,kt as limel_portal,Bt as limel_tooltip,Pt as limel_tooltip_content}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the text that a screen reader reads for a hotkey, e.g. `"Command K"`.
|
|
3
|
+
*
|
|
4
|
+
* @param hotkey - The hotkey string, e.g. `"meta+k"`.
|
|
5
|
+
* @param isApple - Whether the current device is an Apple device.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getHotkeyAriaLabel(hotkey: string, isApple: boolean): string;
|
|
8
|
+
//# sourceMappingURL=get-hotkey-aria-label.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set the `aria-description` of an element on behalf of an owner. The
|
|
3
|
+
* description that the element had before is kept, for when the last owner
|
|
4
|
+
* stops describing it.
|
|
5
|
+
*
|
|
6
|
+
* @param element
|
|
7
|
+
* @param owner
|
|
8
|
+
* @param text
|
|
9
|
+
*/
|
|
10
|
+
export declare function setDescription(element: Element, owner: object, text: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Stop describing an element on behalf of an owner. The text of the owner
|
|
13
|
+
* that described it most recently stays, and when none is left, the
|
|
14
|
+
* description that the element had before is put back. Nothing is changed
|
|
15
|
+
* if the attribute has been changed by someone else.
|
|
16
|
+
*
|
|
17
|
+
* @param element
|
|
18
|
+
* @param owner
|
|
19
|
+
*/
|
|
20
|
+
export declare function clearDescription(element: Element, owner: object): void;
|
|
21
|
+
//# sourceMappingURL=description-registry.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the text that a screen reader should read as the description of the
|
|
3
|
+
* element that a tooltip describes. The label and the helper label are left
|
|
4
|
+
* out when they only repeat the name of the element, or the text of one of
|
|
5
|
+
* its parts, so that they are not read twice.
|
|
6
|
+
*
|
|
7
|
+
* @param element
|
|
8
|
+
* @param label
|
|
9
|
+
* @param helperLabel
|
|
10
|
+
* @param hotkey
|
|
11
|
+
*/
|
|
12
|
+
export declare function getDescription(element: HTMLElement, label: string, helperLabel?: string, hotkey?: string): string;
|
|
13
|
+
//# sourceMappingURL=get-description.d.ts.map
|
|
@@ -43,14 +43,19 @@ export declare class Tooltip {
|
|
|
43
43
|
elementId: string;
|
|
44
44
|
/**
|
|
45
45
|
* Short descriptive text of the owner element.
|
|
46
|
+
* Screen readers read it as a part of the description of the element,
|
|
47
|
+
* unless it only repeats the name that the element already has.
|
|
46
48
|
*/
|
|
47
49
|
label: string;
|
|
48
50
|
/**
|
|
49
51
|
* Additional helper text for the element.
|
|
52
|
+
* Screen readers read it as a part of the description of the element.
|
|
50
53
|
*/
|
|
51
54
|
helperLabel?: string;
|
|
52
55
|
/**
|
|
53
56
|
* Keyboard shortcut to visualize inside the tooltip, e.g. `"ctrl+f"`.
|
|
57
|
+
* Screen readers read it, written out in words, as a part of the
|
|
58
|
+
* description of the element.
|
|
54
59
|
* Display-only: the tooltip does not listen for the keystroke.
|
|
55
60
|
* Catching the hotkey is the consumer's responsibility.
|
|
56
61
|
*/
|
|
@@ -67,14 +72,17 @@ export declare class Tooltip {
|
|
|
67
72
|
private host;
|
|
68
73
|
private open;
|
|
69
74
|
private portalId;
|
|
70
|
-
private tooltipId;
|
|
71
75
|
private ownerElement;
|
|
76
|
+
private describedElement?;
|
|
77
|
+
private latestUpdate;
|
|
72
78
|
private tooltipTimer;
|
|
73
79
|
constructor();
|
|
74
|
-
connectedCallback(): void
|
|
80
|
+
connectedCallback(): Promise<void>;
|
|
75
81
|
disconnectedCallback(): void;
|
|
82
|
+
protected watchDescription(): Promise<void>;
|
|
76
83
|
render(): JSX.Element;
|
|
77
|
-
private
|
|
84
|
+
private updateDescription;
|
|
85
|
+
private restoreDescription;
|
|
78
86
|
private addListeners;
|
|
79
87
|
private removeListeners;
|
|
80
88
|
private showTooltip;
|
|
@@ -4239,15 +4239,15 @@ export namespace Components {
|
|
|
4239
4239
|
*/
|
|
4240
4240
|
"elementId": string;
|
|
4241
4241
|
/**
|
|
4242
|
-
* Additional helper text for the element.
|
|
4242
|
+
* Additional helper text for the element. Screen readers read it as a part of the description of the element.
|
|
4243
4243
|
*/
|
|
4244
4244
|
"helperLabel"?: string;
|
|
4245
4245
|
/**
|
|
4246
|
-
* Keyboard shortcut to visualize inside the tooltip, e.g. `"ctrl+f"`. Display-only: the tooltip does not listen for the keystroke. Catching the hotkey is the consumer's responsibility.
|
|
4246
|
+
* Keyboard shortcut to visualize inside the tooltip, e.g. `"ctrl+f"`. Screen readers read it, written out in words, as a part of the description of the element. Display-only: the tooltip does not listen for the keystroke. Catching the hotkey is the consumer's responsibility.
|
|
4247
4247
|
*/
|
|
4248
4248
|
"hotkey"?: string;
|
|
4249
4249
|
/**
|
|
4250
|
-
* Short descriptive text of the owner element.
|
|
4250
|
+
* Short descriptive text of the owner element. Screen readers read it as a part of the description of the element, unless it only repeats the name that the element already has.
|
|
4251
4251
|
*/
|
|
4252
4252
|
"label": string;
|
|
4253
4253
|
/**
|
|
@@ -11562,15 +11562,15 @@ declare namespace LocalJSX {
|
|
|
11562
11562
|
*/
|
|
11563
11563
|
"elementId": string;
|
|
11564
11564
|
/**
|
|
11565
|
-
* Additional helper text for the element.
|
|
11565
|
+
* Additional helper text for the element. Screen readers read it as a part of the description of the element.
|
|
11566
11566
|
*/
|
|
11567
11567
|
"helperLabel"?: string;
|
|
11568
11568
|
/**
|
|
11569
|
-
* Keyboard shortcut to visualize inside the tooltip, e.g. `"ctrl+f"`. Display-only: the tooltip does not listen for the keystroke. Catching the hotkey is the consumer's responsibility.
|
|
11569
|
+
* Keyboard shortcut to visualize inside the tooltip, e.g. `"ctrl+f"`. Screen readers read it, written out in words, as a part of the description of the element. Display-only: the tooltip does not listen for the keystroke. Catching the hotkey is the consumer's responsibility.
|
|
11570
11570
|
*/
|
|
11571
11571
|
"hotkey"?: string;
|
|
11572
11572
|
/**
|
|
11573
|
-
* Short descriptive text of the owner element.
|
|
11573
|
+
* Short descriptive text of the owner element. Screen readers read it as a part of the description of the element, unless it only repeats the name that the element already has.
|
|
11574
11574
|
*/
|
|
11575
11575
|
"label": string;
|
|
11576
11576
|
/**
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the element that a screen reader describes for the owner element of a
|
|
3
|
+
* tooltip. That is the owner itself if it can be focused, otherwise the first
|
|
4
|
+
* element that can be focused inside it, also inside shadow roots. A disabled
|
|
5
|
+
* control is only used when there is nothing that can be focused, and if
|
|
6
|
+
* there is no control at all, the owner itself is used.
|
|
7
|
+
*
|
|
8
|
+
* An element that passes the focus on to an element in its shadow root is
|
|
9
|
+
* never used itself, since the screen reader lands on the element inside.
|
|
10
|
+
*
|
|
11
|
+
* @param owner
|
|
12
|
+
*/
|
|
13
|
+
export declare function getFocusTarget(owner: HTMLElement): Promise<HTMLElement>;
|
|
14
|
+
//# sourceMappingURL=get-focus-target.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetech/lime-elements",
|
|
3
|
-
"version": "40.10.
|
|
3
|
+
"version": "40.10.1",
|
|
4
4
|
"description": "Lime Elements",
|
|
5
5
|
"author": "Lime Technologies",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"html-escaper": "^3.0.3",
|
|
86
86
|
"jsonlint-mod": "^1.7.6",
|
|
87
87
|
"jsx-dom": "^8.1.6",
|
|
88
|
-
"kompendium": "npm:@limetech/kompendium@^1.
|
|
88
|
+
"kompendium": "npm:@limetech/kompendium@^1.4.1",
|
|
89
89
|
"lodash-es": "^4.17.23",
|
|
90
90
|
"material-components-web": "^13.0.0",
|
|
91
91
|
"mdast-util-to-markdown": "^2.2.0",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"number-abbreviate": "^2.0.0",
|
|
95
95
|
"parse-css-color": "^0.2.1",
|
|
96
96
|
"postal-mime": "^4.0.5",
|
|
97
|
-
"prettier": "^3.9.
|
|
97
|
+
"prettier": "^3.9.10",
|
|
98
98
|
"prosemirror-example-setup": "^1.2.3",
|
|
99
99
|
"prosemirror-markdown": "^1.13.8",
|
|
100
100
|
"prosemirror-model": ">=1.25.12",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as e,H as i,a as n}from"./p-BU9IJqli.js";import{t as r,n as o}from"./p-DjmlD0Mw.js";import{c as a}from"./p-B-tmXAXV.js";import{c as s}from"./p-BrjD-ITe.js";const l=class{constructor(e){t(this,e),this.disabled=!1}componentWillLoad(){this.isApple=a()}render(){const t=r(this.value),n=t.map((t=>function(t,e){const i=(null!=t?t:"").trim();if(!i)return{display:"",isGlyph:!1,ariaName:""};if("+"===i)return{display:"+",isGlyph:!1,ariaName:"plus"};const n=i.toLowerCase();switch(n){case"meta":case"win":case"windows":return e?{display:"⌘",isGlyph:!0,ariaName:"Command"}:{display:"⊞ Win",isGlyph:!1,ariaName:"Windows"};case"cmd":case"command":return{display:"⌘",isGlyph:!0,ariaName:"Command"};case"alt":case"option":return e?{display:"⌥",isGlyph:!0,ariaName:"Option"}:{display:"Alt",isGlyph:!1,ariaName:"Alt"};case"shift":return{display:"⇧",isGlyph:!0,ariaName:"Shift"};case"enter":case"return":return{display:"↩",isGlyph:!0,ariaName:"Enter"};case"tab":return{display:"⇥",isGlyph:!0,ariaName:"Tab"};case"delete":case"del":case"backspace":return e?{display:"⌫",isGlyph:!0,ariaName:"Delete"}:"backspace"===n?{display:"Backspace",isGlyph:!1,ariaName:"Backspace"}:{display:"Del",isGlyph:!1,ariaName:"Delete"};case"ctrl":case"control":return e?{display:"⌃",isGlyph:!0,ariaName:"Control"}:{display:"Ctrl",isGlyph:!1,ariaName:"Control"};case"escape":case"esc":return{display:"Esc",isGlyph:!1,ariaName:"Escape"};case"space":case"spacebar":return{display:"␣",isGlyph:!0,ariaName:"Space"};case"arrowup":case"up":return{display:"↑",isGlyph:!0,ariaName:"Up"};case"arrowdown":case"down":return{display:"↓",isGlyph:!0,ariaName:"Down"};case"arrowleft":case"left":return{display:"←",isGlyph:!0,ariaName:"Left"};case"arrowright":case"right":return{display:"→",isGlyph:!0,ariaName:"Right"}}return{display:i,isGlyph:!1,ariaName:i}}(t,this.isApple))),o=n.map((t=>t.ariaName)).filter(Boolean).join(" ");return e(i,{key:"91e09b5c874135ac3473c995ffce864a1cf8a9d6","aria-label":o||void 0},n.map((({display:i,isGlyph:n},r)=>e("kbd",{key:`${t[r]}-${r}`,class:n?"is-glyph":void 0},e("span",null,i)))))}};l.style='@charset "UTF-8";kbd{display:inline-block;font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-weight:600;color:rgb(var(--contrast-1100));white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:normal;border-radius:0.125rem;border-style:solid;border-color:rgb(var(--contrast-500));border-width:0 1px 0.1875rem 1px;padding:0.0625rem 0.375rem;margin:0 0.25rem;background-color:rgb(var(--contrast-200));box-shadow:var(--button-shadow-normal), 0 0.625rem 0.375rem -0.5rem rgb(var(--color-black), 0.02), 0 0.025rem 0.5rem 0 rgb(var(--contrast-100)) inset}:host(limel-hotkey){display:flex;align-items:center;justify-content:center;gap:0.25rem}:host(limel-hotkey[disabled]:not([disabled=false])){opacity:0.5}kbd{text-transform:var(--hotkey-text-transform, uppercase);margin:0;font-size:0.75rem;box-shadow:var(--button-shadow-pressed), 0 0.625rem 0.375px -0.5rem rgb(var(--color-black), 0.02), 0 0.025rem 0.5rem 0 rgb(var(--contrast-100)) inset}span{display:inline-block}kbd.is-glyph span{transform:scale(1.2)}';var c="top",u="bottom",h="right",f="left",d="auto",p=[c,u,h,f],m="start",b="end",v="viewport",y="popper",g=p.reduce((function(t,e){return t.concat([e+"-"+m,e+"-"+b])}),[]),w=[].concat(p,[d]).reduce((function(t,e){return t.concat([e,e+"-"+m,e+"-"+b])}),[]),x=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function O(t){return t?(t.nodeName||"").toLowerCase():null}function k(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function j(t){return t instanceof k(t).Element||t instanceof Element}function C(t){return t instanceof k(t).HTMLElement||t instanceof HTMLElement}function N(t){return"undefined"!=typeof ShadowRoot&&(t instanceof k(t).ShadowRoot||t instanceof ShadowRoot)}function G(t){return t.split("-")[0]}var M=Math.max,A=Math.min,S=Math.round;function P(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function B(){return!/^((?!chrome|android).)*safari/i.test(P())}function D(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),r=1,o=1;e&&C(t)&&(r=t.offsetWidth>0&&S(n.width)/t.offsetWidth||1,o=t.offsetHeight>0&&S(n.height)/t.offsetHeight||1);var a=(j(t)?k(t):window).visualViewport,s=!B()&&i,l=(n.left+(s&&a?a.offsetLeft:0))/r,c=(n.top+(s&&a?a.offsetTop:0))/o,u=n.width/r,h=n.height/o;return{width:u,height:h,top:c,right:l+u,bottom:c+h,left:l,x:l,y:c}}function E(t){var e=D(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function L(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&N(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function R(t){return k(t).getComputedStyle(t)}function W(t){return["table","td","th"].indexOf(O(t))>=0}function z(t){return((j(t)?t.ownerDocument:t.document)||window.document).documentElement}function T(t){return"html"===O(t)?t:t.assignedSlot||t.parentNode||(N(t)?t.host:null)||z(t)}function q(t){return C(t)&&"fixed"!==R(t).position?t.offsetParent:null}function H(t){for(var e=k(t),i=q(t);i&&W(i)&&"static"===R(i).position;)i=q(i);return i&&("html"===O(i)||"body"===O(i)&&"static"===R(i).position)?e:i||function(t){var e=/firefox/i.test(P());if(/Trident/i.test(P())&&C(t)&&"fixed"===R(t).position)return null;var i=T(t);for(N(i)&&(i=i.host);C(i)&&["html","body"].indexOf(O(i))<0;){var n=R(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function I(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function F(t,e,i){return M(t,A(e,i))}function _(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function V(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}function $(t){return t.split("-")[1]}var U={top:"auto",right:"auto",bottom:"auto",left:"auto"};function X(t){var e,i=t.popper,n=t.popperRect,r=t.placement,o=t.variation,a=t.offsets,s=t.position,l=t.gpuAcceleration,d=t.adaptive,p=t.roundOffsets,m=t.isFixed,v=a.x,y=void 0===v?0:v,g=a.y,w=void 0===g?0:g,x="function"==typeof p?p({x:y,y:w}):{x:y,y:w};y=x.x,w=x.y;var O=a.hasOwnProperty("x"),j=a.hasOwnProperty("y"),C=f,N=c,G=window;if(d){var M=H(i),A="clientHeight",P="clientWidth";M===k(i)&&"static"!==R(M=z(i)).position&&"absolute"===s&&(A="scrollHeight",P="scrollWidth"),(r===c||(r===f||r===h)&&o===b)&&(N=u,w-=(m&&M===G&&G.visualViewport?G.visualViewport.height:M[A])-n.height,w*=l?1:-1),r!==f&&(r!==c&&r!==u||o!==b)||(C=h,y-=(m&&M===G&&G.visualViewport?G.visualViewport.width:M[P])-n.width,y*=l?1:-1)}var B,D=Object.assign({position:s},d&&U),E=!0===p?function(t,e){var i=t.y,n=e.devicePixelRatio||1;return{x:S(t.x*n)/n||0,y:S(i*n)/n||0}}({x:y,y:w},k(i)):{x:y,y:w};return y=E.x,w=E.y,Object.assign({},D,l?((B={})[N]=j?"0":"",B[C]=O?"0":"",B.transform=(G.devicePixelRatio||1)<=1?"translate("+y+"px, "+w+"px)":"translate3d("+y+"px, "+w+"px, 0)",B):((e={})[N]=j?w+"px":"",e[C]=O?y+"px":"",e.transform="",e))}var J={passive:!0},K={left:"right",right:"left",bottom:"top",top:"bottom"};function Q(t){return t.replace(/left|right|bottom|top/g,(function(t){return K[t]}))}var Y={start:"end",end:"start"};function Z(t){return t.replace(/start|end/g,(function(t){return Y[t]}))}function tt(t){var e=k(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function et(t){return D(z(t)).left+tt(t).scrollLeft}function it(t){var e=R(t);return/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function nt(t){return["html","body","#document"].indexOf(O(t))>=0?t.ownerDocument.body:C(t)&&it(t)?t:nt(T(t))}function rt(t,e){var i;void 0===e&&(e=[]);var n=nt(t),r=n===(null==(i=t.ownerDocument)?void 0:i.body),o=k(n),a=r?[o].concat(o.visualViewport||[],it(n)?n:[]):n,s=e.concat(a);return r?s:s.concat(rt(T(a)))}function ot(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function at(t,e,i){return e===v?ot(function(t,e){var i=k(t),n=z(t),r=i.visualViewport,o=n.clientWidth,a=n.clientHeight,s=0,l=0;if(r){o=r.width,a=r.height;var c=B();(c||!c&&"fixed"===e)&&(s=r.offsetLeft,l=r.offsetTop)}return{width:o,height:a,x:s+et(t),y:l}}(t,i)):j(e)?function(t,e){var i=D(t,!1,"fixed"===e);return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}(e,i):ot(function(t){var e,i=z(t),n=tt(t),r=null==(e=t.ownerDocument)?void 0:e.body,o=M(i.scrollWidth,i.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=M(i.scrollHeight,i.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),s=-n.scrollLeft+et(t),l=-n.scrollTop;return"rtl"===R(r||i).direction&&(s+=M(i.clientWidth,r?r.clientWidth:0)-o),{width:o,height:a,x:s,y:l}}(z(t)))}function st(t){var e,i=t.reference,n=t.element,r=t.placement,o=r?G(r):null,a=r?$(r):null,s=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(o){case c:e={x:s,y:i.y-n.height};break;case u:e={x:s,y:i.y+i.height};break;case h:e={x:i.x+i.width,y:l};break;case f:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var d=o?I(o):null;if(null!=d){var p="y"===d?"height":"width";switch(a){case m:e[d]=e[d]-(i[p]/2-n[p]/2);break;case b:e[d]=e[d]+(i[p]/2-n[p]/2)}}return e}function lt(t,e){void 0===e&&(e={});var i=e.placement,n=void 0===i?t.placement:i,r=e.strategy,o=void 0===r?t.strategy:r,a=e.boundary,s=void 0===a?"clippingParents":a,l=e.rootBoundary,f=void 0===l?v:l,d=e.elementContext,m=void 0===d?y:d,b=e.altBoundary,g=void 0!==b&&b,w=e.padding,x=void 0===w?0:w,k=_("number"!=typeof x?x:V(x,p)),N=t.rects.popper,G=t.elements[g?m===y?"reference":y:m],S=function(t,e,i,n){var r="clippingParents"===e?function(t){var e=rt(T(t)),i=["absolute","fixed"].indexOf(R(t).position)>=0&&C(t)?H(t):t;return j(i)?e.filter((function(t){return j(t)&&L(t,i)&&"body"!==O(t)})):[]}(t):[].concat(e),o=[].concat(r,[i]),a=o.reduce((function(e,i){var r=at(t,i,n);return e.top=M(r.top,e.top),e.right=A(r.right,e.right),e.bottom=A(r.bottom,e.bottom),e.left=M(r.left,e.left),e}),at(t,o[0],n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(j(G)?G:G.contextElement||z(t.elements.popper),s,f,o),P=D(t.elements.reference),B=st({reference:P,element:N,placement:n}),E=ot(Object.assign({},N,B)),W=m===y?E:P,q={top:S.top-W.top+k.top,bottom:W.bottom-S.bottom+k.bottom,left:S.left-W.left+k.left,right:W.right-S.right+k.right},I=t.modifiersData.offset;if(m===y&&I){var F=I[n];Object.keys(q).forEach((function(t){var e=[h,u].indexOf(t)>=0?1:-1,i=[c,u].indexOf(t)>=0?"y":"x";q[t]+=F[i]*e}))}return q}function ct(t,e){void 0===e&&(e={});var i=e.boundary,n=e.rootBoundary,r=e.padding,o=e.flipVariations,a=e.allowedAutoPlacements,s=void 0===a?w:a,l=$(e.placement),c=l?o?g:g.filter((function(t){return $(t)===l})):p,u=c.filter((function(t){return s.indexOf(t)>=0}));0===u.length&&(u=c);var h=u.reduce((function(e,o){return e[o]=lt(t,{placement:o,boundary:i,rootBoundary:n,padding:r})[G(o)],e}),{});return Object.keys(h).sort((function(t,e){return h[t]-h[e]}))}var ut={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var r=i.mainAxis,o=void 0===r||r,a=i.altAxis,s=void 0===a||a,l=i.fallbackPlacements,p=i.padding,b=i.boundary,v=i.rootBoundary,y=i.altBoundary,g=i.flipVariations,w=void 0===g||g,x=i.allowedAutoPlacements,O=e.options.placement,k=G(O),j=l||(k!==O&&w?function(t){if(G(t)===d)return[];var e=Q(t);return[Z(t),e,Z(e)]}(O):[Q(O)]),C=[O].concat(j).reduce((function(t,i){return t.concat(G(i)===d?ct(e,{placement:i,boundary:b,rootBoundary:v,padding:p,flipVariations:w,allowedAutoPlacements:x}):i)}),[]),N=e.rects.reference,M=e.rects.popper,A=new Map,S=!0,P=C[0],B=0;B<C.length;B++){var D=C[B],E=G(D),L=$(D)===m,R=[c,u].indexOf(E)>=0,W=R?"width":"height",z=lt(e,{placement:D,boundary:b,rootBoundary:v,altBoundary:y,padding:p}),T=R?L?h:f:L?u:c;N[W]>M[W]&&(T=Q(T));var q=Q(T),H=[];if(o&&H.push(z[E]<=0),s&&H.push(z[T]<=0,z[q]<=0),H.every((function(t){return t}))){P=D,S=!1;break}A.set(D,H)}if(S)for(var I=function(t){var e=C.find((function(e){var i=A.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return P=e,"break"},F=w?3:1;F>0&&"break"!==I(F);F--);e.placement!==P&&(e.modifiersData[n]._skip=!0,e.placement=P,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function ht(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function ft(t){return[c,h,u,f].some((function(e){return t[e]>=0}))}function dt(t,e,i){void 0===i&&(i=!1);var n,r,o=C(e),a=C(e)&&function(t){var e=t.getBoundingClientRect(),i=S(e.width)/t.offsetWidth||1,n=S(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),s=z(e),l=D(t,a,i),c={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(o||!o&&!i)&&(("body"!==O(e)||it(s))&&(c=(n=e)!==k(n)&&C(n)?{scrollLeft:(r=n).scrollLeft,scrollTop:r.scrollTop}:tt(n)),C(e)?((u=D(e,!0)).x+=e.clientLeft,u.y+=e.clientTop):s&&(u.x=et(s))),{x:l.left+c.scrollLeft-u.x,y:l.top+c.scrollTop-u.y,width:l.width,height:l.height}}function pt(t){var e=new Map,i=new Set,n=[];function r(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&r(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){i.has(t.name)||r(t)})),n}var mt={placement:"bottom",modifiers:[],strategy:"absolute"};function bt(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function vt(t){void 0===t&&(t={});var e=t.defaultModifiers,i=void 0===e?[]:e,n=t.defaultOptions,r=void 0===n?mt:n;return function(t,e,n){void 0===n&&(n=r);var o,a,s={placement:"bottom",orderedModifiers:[],options:Object.assign({},mt,r),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},l=[],c=!1,u={state:s,setOptions:function(n){var o="function"==typeof n?n(s.options):n;h(),s.options=Object.assign({},r,s.options,o),s.scrollParents={reference:j(t)?rt(t):t.contextElement?rt(t.contextElement):[],popper:rt(e)};var a,c,f=function(t){var e=pt(t);return x.reduce((function(t,i){return t.concat(e.filter((function(t){return t.phase===i})))}),[])}((a=[].concat(i,s.options.modifiers),c=a.reduce((function(t,e){var i=t[e.name];return t[e.name]=i?Object.assign({},i,e,{options:Object.assign({},i.options,e.options),data:Object.assign({},i.data,e.data)}):e,t}),{}),Object.keys(c).map((function(t){return c[t]}))));return s.orderedModifiers=f.filter((function(t){return t.enabled})),s.orderedModifiers.forEach((function(t){var e=t.options,i=t.effect;if("function"==typeof i){var n=i({state:s,name:t.name,instance:u,options:void 0===e?{}:e});l.push(n||function(){})}})),u.update()},forceUpdate:function(){if(!c){var t=s.elements,e=t.reference,i=t.popper;if(bt(e,i)){s.rects={reference:dt(e,H(i),"fixed"===s.options.strategy),popper:E(i)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach((function(t){return s.modifiersData[t.name]=Object.assign({},t.data)}));for(var n=0;n<s.orderedModifiers.length;n++)if(!0!==s.reset){var r=s.orderedModifiers[n],o=r.fn,a=r.options;"function"==typeof o&&(s=o({state:s,options:void 0===a?{}:a,name:r.name,instance:u})||s)}else s.reset=!1,n=-1}}},update:(o=function(){return new Promise((function(t){u.forceUpdate(),t(s)}))},function(){return a||(a=new Promise((function(t){Promise.resolve().then((function(){a=void 0,t(o())}))}))),a}),destroy:function(){h(),c=!0}};if(!bt(t,e))return u;function h(){l.forEach((function(t){return t()})),l=[]}return u.setOptions(n).then((function(t){!c&&n.onFirstUpdate&&n.onFirstUpdate(t)})),u}}var yt=vt({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,r=n.scroll,o=void 0===r||r,a=n.resize,s=void 0===a||a,l=k(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",i.update,J)})),s&&l.addEventListener("resize",i.update,J),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",i.update,J)})),s&&l.removeEventListener("resize",i.update,J)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state;e.modifiersData[t.name]=st({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,r=void 0===n||n,o=i.adaptive,a=void 0===o||o,s=i.roundOffsets,l=void 0===s||s,c={placement:G(e.placement),variation:$(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,X(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,X(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},r=e.elements[t];C(r)&&O(r)&&(Object.assign(r.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?r.removeAttribute(t):r.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],r=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});C(n)&&O(n)&&(Object.assign(n.style,o),Object.keys(r).forEach((function(t){n.removeAttribute(t)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.name,n=t.options.offset,r=void 0===n?[0,0]:n,o=w.reduce((function(t,i){return t[i]=function(t,e,i){var n=G(t),r=[f,c].indexOf(n)>=0?-1:1,o="function"==typeof i?i(Object.assign({},e,{placement:t})):i,a=o[0],s=o[1];return a=a||0,s=(s||0)*r,[f,h].indexOf(n)>=0?{x:s,y:a}:{x:a,y:s}}(i,e.rects,r),t}),{}),a=o[e.placement],s=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=a.x,e.modifiersData.popperOffsets.y+=s),e.modifiersData[i]=o}},ut,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,r=i.mainAxis,o=void 0===r||r,a=i.altAxis,s=void 0!==a&&a,l=i.tether,d=void 0===l||l,p=i.tetherOffset,b=void 0===p?0:p,v=lt(e,{boundary:i.boundary,rootBoundary:i.rootBoundary,padding:i.padding,altBoundary:i.altBoundary}),y=G(e.placement),g=$(e.placement),w=!g,x=I(y),O="x"===x?"y":"x",k=e.modifiersData.popperOffsets,j=e.rects.reference,C=e.rects.popper,N="function"==typeof b?b(Object.assign({},e.rects,{placement:e.placement})):b,S="number"==typeof N?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),P=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,B={x:0,y:0};if(k){if(o){var D,L="y"===x?c:f,R="y"===x?u:h,W="y"===x?"height":"width",z=k[x],T=z+v[L],q=z-v[R],_=d?-C[W]/2:0,V=g===m?j[W]:C[W],U=g===m?-C[W]:-j[W],X=e.elements.arrow,J=d&&X?E(X):{width:0,height:0},K=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},Q=K[L],Y=K[R],Z=F(0,j[W],J[W]),tt=w?j[W]/2-_-Z-Q-S.mainAxis:V-Z-Q-S.mainAxis,et=w?-j[W]/2+_+Z+Y+S.mainAxis:U+Z+Y+S.mainAxis,it=e.elements.arrow&&H(e.elements.arrow),nt=null!=(D=null==P?void 0:P[x])?D:0,rt=z+et-nt,ot=F(d?A(T,z+tt-nt-(it?"y"===x?it.clientTop||0:it.clientLeft||0:0)):T,z,d?M(q,rt):q);k[x]=ot,B[x]=ot-z}if(s){var at,st=k[O],ct="y"===O?"height":"width",ut=st+v["x"===x?c:f],ht=st-v["x"===x?u:h],ft=-1!==[c,f].indexOf(y),dt=null!=(at=null==P?void 0:P[O])?at:0,pt=ft?ut:st-j[ct]-C[ct]-dt+S.altAxis,mt=ft?st+j[ct]+C[ct]-dt-S.altAxis:ht,bt=d&&ft?function(t,e,i){var n=F(t,e,i);return n>i?i:n}(pt,st,mt):F(d?pt:ut,st,d?mt:ht);k[O]=bt,B[O]=bt-st}e.modifiersData[n]=B}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,r=t.options,o=i.elements.arrow,a=i.modifiersData.popperOffsets,s=G(i.placement),l=I(s),d=[f,h].indexOf(s)>=0?"height":"width";if(o&&a){var m=function(t,e){return _("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:V(t,p))}(r.padding,i),b=E(o),v="y"===l?c:f,y="y"===l?u:h,g=i.rects.reference[d]+i.rects.reference[l]-a[l]-i.rects.popper[d],w=a[l]-i.rects.reference[l],x=H(o),O=x?"y"===l?x.clientHeight||0:x.clientWidth||0:0,k=O/2-b[d]/2+(g/2-w/2),j=F(m[v],k,O-b[d]-m[y]);i.modifiersData[n]=((e={})[l]=j,e.centerOffset=j-k,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&L(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,r=e.rects.popper,o=e.modifiersData.preventOverflow,a=lt(e,{elementContext:"reference"}),s=lt(e,{altBoundary:!0}),l=ht(a,n),c=ht(s,r,o),u=ft(l),h=ft(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":h})}}]});const gt="is-visible",wt="is-hiding",xt=class{get anchorElement(){return this.anchor||this.host}constructor(e){t(this,e),this.openDirection="bottom",this.position="absolute",this.containerStyle={},this.inheritParentWidth=!1,this.visible=!1,this.anchor=null,this.loaded=!1,this.writtenStyles={},this.scheduledRestyle=null,this.parents=new WeakMap}disconnectedCallback(){this.removeContainer(),this.destroyPopper(),this.observer=null,this.container=null}connectedCallback(){this.loaded&&this.visible&&this.init()}componentDidLoad(){this.loaded=!0,this.connectedCallback()}init(){this.host.isConnected&&(this.createContainer(),this.hideContainer(),this.attachContainer(),this.styleContainer(),this.visible&&(this.createPopper(),this.showContainer()))}render(){return e("slot",{key:"f4db0b146b4cd851a9837bf10dc7d331cd5a9dce"})}onVisible(){this.container||!this.visible?this.visible?(this.styleContainer(),this.createPopper(),requestAnimationFrame((()=>{this.showContainer()}))):this.animateHideAndCleanup():this.init()}createContainer(){const t=this.host.shadowRoot.querySelector("slot"),e=t.assignedElements&&t.assignedElements()||[];this.writtenStyles={},this.container=document.createElement("div"),this.container.setAttribute("id",this.containerId),this.container.setAttribute("class","limel-portal--container"),Object.assign(this.container,{portalSource:this.host});for(const t of e)this.parents.set(t,t.parentElement),this.container.append(t)}attachContainer(){this.getParent().append(this.container)}removeContainer(){if(this.container){for(const t of[...this.container.children]){const e=this.parents.get(t);e&&e.append(t)}this.container.remove()}}hideContainer(){this.container&&this.container.classList.remove(gt)}showContainer(){this.container.classList.add(gt)}animateHideAndCleanup(){this.container&&(this.container.classList.add(wt),this.styleContainer(),setTimeout((()=>{this.container&&(this.container.classList.remove(wt),this.visible||(this.container.classList.remove(gt),this.destroyPopper()))}),300))}styleContainer(){const t=this.host.getBoundingClientRect();this.setContainerWidth(t),this.setContainerHeight(t),this.setContainerStyles()}setContainerWidth(t){if(!this.inheritParentWidth)return;const e=t.width>0?t.width:this.getContentWidth(this.container);this.setContainerStyle("width",`${e}px`)}getContentWidth(t){if(!t)return null;const e=t.getBoundingClientRect().width;if(0!==e)return e;const i=t.querySelector("*");return this.getContentWidth(i)}setContainerStyles(){for(const[t,e]of Object.entries(this.containerStyle))this.container.style[t]=e}setContainerStyle(t,e){this.writtenStyles[t]!==e&&(this.writtenStyles[t]=e,this.container.style[t]=e)}createPopper(){this.destroyPopper();const t=this.createPopperConfig();this.popperInstance=yt(this.anchorElement,this.container,t),this.observeResize()}destroyPopper(){var t,e;null===(t=this.observer)||void 0===t||t.disconnect(),this.cancelScheduledRestyle(),null===(e=this.popperInstance)||void 0===e||e.destroy(),this.popperInstance=null}observeResize(){var t;"ResizeObserver"in window&&(null!==(t=this.observer)&&void 0!==t||(this.observer=new ResizeObserver((()=>{this.scheduleRestyle()}))),this.observer.observe(this.container),this.observer.observe(this.anchorElement))}scheduleRestyle(){null===this.scheduledRestyle&&(this.scheduledRestyle=requestAnimationFrame((()=>{this.scheduledRestyle=null,this.popperInstance&&(this.styleContainer(),this.popperInstance.update())})))}cancelScheduledRestyle(){null!==this.scheduledRestyle&&(cancelAnimationFrame(this.scheduledRestyle),this.scheduledRestyle=null)}createPopperConfig(){const t=this.getPlacement(this.openDirection),e=this.getFlipPlacement(this.openDirection);return{strategy:this.position,placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:[e]}}]}}getPlacement(t){return{"left-start":"left-start",left:"left","left-end":"left-end","right-start":"right-start",right:"right","right-end":"right-end","top-start":"top-start",top:"top","top-end":"top-end","bottom-start":"bottom-start",bottom:"bottom","bottom-end":"bottom-end"}[t]}getFlipPlacement(t){return{"left-start":"right-start",left:"right","left-end":"right-end","right-start":"left-start",right:"left","right-end":"left-end","top-start":"bottom-start",top:"bottom","top-end":"bottom-end","bottom-start":"top-start",bottom:"top","bottom-end":"top-end"}[t]}setContainerHeight(t){const e=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0),i=Math.max(t.top,0),n=Math.max(e-t.bottom,0),r=Math.max(0,Math.round(Math.max(i,n)-16));this.setContainerStyle("maxHeight",`${r}px`)}getParent(){let t=this.anchorElement;for(;t;){const e=t.closest(".limel-portal--parent");if(e)return e;t=t.getRootNode().host}return document.body}get host(){return n(this)}static get watchers(){return{visible:[{onVisible:0}]}}};xt.style=":host(limel-portal){display:block;position:absolute;top:0;bottom:0;width:100%;pointer-events:none}:host([hidden]){display:none}slot{display:none}";class Ot{constructor(t,e,i=500){this.timerHandle=null,this.showCallback=t,this.hideCallback=e,this.delayForShowing=i}showAfterDelay(){this.timerHandle||(this.timerHandle=setTimeout(this.showCallback,this.delayForShowing))}hide(){clearTimeout(this.timerHandle),this.timerHandle=null,this.hideCallback()}}const kt=class{constructor(e){t(this,e),this.maxlength=50,this.openDirection="top",this.showTooltip=()=>{this.tooltipTimer.showAfterDelay()},this.hideTooltip=()=>{this.tooltipTimer.hide()},this.portalId=s(),this.tooltipId=s(),this.tooltipTimer=new Ot((()=>this.open=!0),(()=>this.open=!1))}connectedCallback(){this.ownerElement=function(t,e){let i=e;do{i=i.parentNode}while(i&&i.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&i.nodeType!==Node.DOCUMENT_NODE);return null==i?void 0:i.getElementById(t)}(this.elementId,this.host),this.setOwnerAriaDescribedby(),this.addListeners()}disconnectedCallback(){this.removeListeners()}render(){const t=getComputedStyle(this.host).getPropertyValue("--tooltip-z-index");return e("div",{key:"11a9db0e1b1e615ddbdeea5eb2c5089e1f9eadeb",class:"trigger-anchor"},e("limel-portal",{key:"28e7ffeb63ff24978dd2bd1ed0b0b2aa278abbde",openDirection:this.openDirection,visible:this.open,containerId:this.portalId,containerStyle:{"z-index":t,"pointer-events":"none"},anchor:this.ownerElement},e("limel-tooltip-content",{key:"abc48a7948a932c081a44fb1d617bc3b351d452c",label:this.label,helperLabel:this.helperLabel,hotkey:this.hotkey,maxlength:this.maxlength,role:"tooltip","aria-hidden":!this.open,id:this.tooltipId})))}setOwnerAriaDescribedby(){var t;null===(t=this.ownerElement)||void 0===t||t.setAttribute("aria-describedby",this.tooltipId)}addListeners(){var t,e,i,n;null===(t=this.ownerElement)||void 0===t||t.addEventListener("mouseover",this.showTooltip),null===(e=this.ownerElement)||void 0===e||e.addEventListener("mouseout",this.hideTooltip),null===(i=this.ownerElement)||void 0===i||i.addEventListener("focus",this.showTooltip),null===(n=this.ownerElement)||void 0===n||n.addEventListener("blur",this.hideTooltip)}removeListeners(){var t,e,i,n;null===(t=this.ownerElement)||void 0===t||t.removeEventListener("mouseover",this.showTooltip),null===(e=this.ownerElement)||void 0===e||e.removeEventListener("mouseout",this.hideTooltip),null===(i=this.ownerElement)||void 0===i||i.removeEventListener("focus",this.showTooltip),null===(n=this.ownerElement)||void 0===n||n.removeEventListener("blur",this.hideTooltip)}get host(){return n(this)}};kt.style=":host(limel-tooltip){position:absolute;pointer-events:none}";const jt=class{constructor(e){t(this,e)}render(){let t=!1;return this.helperLabel&&this.maxlength&&(t=this.label.length+this.helperLabel.length>this.maxlength),e(i,{key:"63d36a0e0f1fb0e4eb94c5c216c80299d82f63b2",class:{"has-column-layout":t},style:this.maxlength?{"--tooltip-max-width-of-text":`${this.maxlength}ch`}:void 0},e("div",{key:"6d4ecf58b8854edeece92a53065816292a2a39b9",class:"label"},this.label),this.renderHelperLabel(),this.renderHotkey())}renderHelperLabel(){if(this.helperLabel)return e("div",{class:"helper-label"},this.helperLabel)}renderHotkey(){if(!this.hotkey)return;const t=o(this.hotkey);return t?e("limel-hotkey",{value:t}):void 0}};jt.style=":host(limel-tooltip-content){box-sizing:border-box;display:flex;align-items:center;gap:0.5rem 1rem;border-radius:0.25rem;padding:0.25rem 0.5rem;font-size:var(--limel-theme-default-font-size);line-height:normal;background-color:rgb(var(--contrast-1300));box-shadow:var(--shadow-depth-16), var(--shadow-brighten-edges-inside)}:host(.has-column-layout){flex-direction:column;align-items:flex-start;padding:0.5rem;max-width:min(var(--tooltip-max-width-of-text), 80vw)}:host(.has-column-layout) .label,:host(.has-column-layout) .helper-label{flex-grow:1}.label,.helper-label{min-width:0;min-height:0}.label{color:rgb(var(--contrast-200))}.helper-label{color:rgb(var(--contrast-800))}limel-hotkey{margin-right:-0.25rem}";export{l as limel_hotkey,xt as limel_portal,kt as limel_tooltip,jt as limel_tooltip_content}
|