@limetech/lime-elements 39.16.3 → 39.17.0
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 +21 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/{limel-portal_3.cjs.entry.js → limel-hotkey_4.cjs.entry.js} +148 -13
- package/dist/cjs/limel-icon-button.cjs.entry.js +1 -1
- package/dist/cjs/limel-markdown.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/icon-button/icon-button.js +1 -1
- package/dist/collection/components/markdown/markdown.css +18 -1
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.css +18 -1
- package/dist/collection/components/tooltip/tooltip-content.css +21 -16
- package/dist/collection/components/tooltip/tooltip-content.js +40 -9
- package/dist/collection/components/tooltip/tooltip.js +26 -17
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/{limel-portal_3.entry.js → limel-hotkey_4.entry.js} +149 -15
- package/dist/esm/limel-icon-button.entry.js +1 -1
- package/dist/esm/limel-markdown.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-02817f83.entry.js → p-4e130ff5.entry.js} +1 -1
- package/dist/lime-elements/p-6b956d6d.entry.js +1 -0
- package/dist/lime-elements/{p-77abb595.entry.js → p-70541fe3.entry.js} +1 -1
- package/dist/lime-elements/p-cba72cd6.entry.js +1 -0
- package/dist/types/components/tooltip/tooltip-content.d.ts +7 -1
- package/dist/types/components/tooltip/tooltip.d.ts +9 -15
- package/dist/types/components.d.ts +28 -42
- package/package.json +1 -1
- package/dist/cjs/limel-hotkey.cjs.entry.js +0 -128
- package/dist/esm/limel-hotkey.entry.js +0 -126
- package/dist/lime-elements/p-173def13.entry.js +0 -1
- package/dist/lime-elements/p-7acd89d5.entry.js +0 -1
- package/dist/lime-elements/p-bd81d7bb.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,h as t,H as e,a as n}from"./p-DBTJNfo7.js";import{m as a,r as i}from"./p-BgTwPGeH.js";import{c as s}from"./p-JbKhhoXs.js";import{d as r,g as l}from"./p-CgNJbSP4.js";const d=class{constructor(t){o(this,t),this.elevated=!1,this.disabled=!1,this.tooltipId=s(),this.filterClickWhenDisabled=o=>{this.disabled&&o.preventDefault()}}connectedCallback(){this.initialize()}componentWillLoad(){a(this.host)}disconnectedCallback(){i(this.host)}componentDidLoad(){this.initialize()}initialize(){this.host.shadowRoot.querySelector(".mdc-icon-button")}render(){const o={};return this.host.hasAttribute("tabindex")&&(o.tabindex=this.host.getAttribute("tabindex")),t(e,{key:"0df3febef19dcdb72c7c7f3740090414b313be51",onClick:this.filterClickWhenDisabled},t("button",Object.assign({key:"119641239ebd336ca5af28ce3452c940a552eccb","aria-label":this.label,disabled:this.disabled,id:this.tooltipId},o),this.renderIcon(),this.renderTooltip(this.tooltipId)))}renderIcon(){var o,e;const n=l(this.icon),a=r(this.icon);return t("limel-icon",{name:n,"aria-label":a,"aria-hidden":a?null:"true",style:{color:`${null===(o=this.icon)||void 0===o?void 0:o.color}`,"--icon-background-color":`${null===(e=this.icon)||void 0===e?void 0:e.backgroundColor}`}})}renderTooltip(o){if(this.label)return t("limel-tooltip",{elementId:o,label:this.label,helperLabel:this.helperLabel})}static get delegatesFocus(){return!0}get host(){return n(this)}};d.style='@charset "UTF-8";:host([hidden]){display:none}:host([aria-expanded=true]) button,:host([aria-expanded]:not([aria-expanded=false])) button{box-shadow:var(--button-shadow-inset-pressed) !important}button{appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;text-align:inherit}button:not(:disabled){transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:var(--icon-background-color, transparent)}button:not(:disabled):hover,button:not(:disabled):focus,button:not(:disabled):focus-visible{will-change:color, background-color, box-shadow, transform}button:not(:disabled):hover,button:not(:disabled):focus-visible{transform:translate3d(0, 0.01rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color)}button:not(:disabled):hover{box-shadow:var(--button-shadow-hovered)}button:not(:disabled):active{--limel-clickable-transform-timing-function:cubic-bezier( 0.83, -0.15, 0.49, 1.16 );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}button:not(:disabled):hover,button:not(:disabled):active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}button:not(:disabled):focus{outline:none}button:not(:disabled):focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}button{display:inline-flex;align-items:center;justify-content:center;height:2.25rem;width:2.25rem;border-radius:50%}button:disabled{cursor:not-allowed;color:var(--limel-theme-text-disabled-on-background-color)}:host([elevated]) button:not(:hover):not(:active):not(:disabled):not(:focus-visible){box-shadow:var(--button-shadow-normal)}:host([elevated]) button:disabled{box-shadow:var(--button-shadow-normal)}limel-icon{padding:0.25rem;width:1.75rem}';export{d as limel_icon_button}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,h as t,H as r}from"./p-DBTJNfo7.js";import{m as o}from"./p-DdYOzHlg.js";import{g as a}from"./p-Dnt5w_Bp.js";import{d as n}from"./p-DJvGLFul.js";import"./p-B85MJLTf.js";class l{constructor(e){this.handleIntersection=e=>{for(const t of e)if(t.isIntersecting){const e=t.target,r=e.dataset.src;r&&(e.setAttribute("src",r),delete e.dataset.src),this.observer.unobserve(e)}},this.observer=new IntersectionObserver(this.handleIntersection);const t=e.querySelectorAll("img");for(const e of t)this.observer.observe(e)}disconnect(){this.observer.disconnect()}}var i;const s=new Map(Object.entries(null!==(i=n.protocols)&&void 0!==i?i:{}).map((([e,t])=>[e,new Set(t)])));function d(e,t){for(const r of t){const t=e.getAttribute(r);if(!t)continue;const o=m(t);if(void 0!==o){const t=f(o);e[h(r)]=t}}}function m(e){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch(e){try{const e=t.replaceAll(""",'"').replaceAll(""",'"').replaceAll(""",'"').replaceAll("'","'").replaceAll("'","'").replaceAll("'","'").replaceAll("&","&");return JSON.parse(e)}catch(e){return}}}function c(e,t){const r=e.trim(),o=r.indexOf(":");if(-1===o||/[?#/]/.test(r.slice(0,o)))return!0;const a=r.slice(0,o).toLowerCase();return t.has(a)}function f(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(f);const t=Object.assign({},e);for(const e of Object.keys(t)){const r=s.get(e);r&&"string"==typeof t[e]&&!c(t[e],r)?(console.warn(`limel-markdown: Removed unsafe URL from "${e}" during sanitization.`),delete t[e]):"object"==typeof t[e]&&null!==t[e]&&(t[e]=f(t[e]))}return t}function h(e){return e.replaceAll(/-([a-z])/g,((e,t)=>t.toUpperCase()))}var b,u="undefined"==typeof document?void 0:document,g=!!u&&"content"in u.createElement("template"),p=!!u&&u.createRange&&"createContextualFragment"in u.createRange();function v(e,t){var r,o,a=e.nodeName,n=t.nodeName;return a===n||(r=a.charCodeAt(0),o=n.charCodeAt(0),r<=90&&o>=97?a===n.toUpperCase():o<=90&&r>=97&&n===a.toUpperCase())}function w(e,t,r){e[r]!==t[r]&&(e[r]=t[r],e[r]?e.setAttribute(r,""):e.removeAttribute(r))}var k={OPTION:function(e,t){var r=e.parentNode;if(r){var o=r.nodeName.toUpperCase();"OPTGROUP"===o&&(o=(r=r.parentNode)&&r.nodeName.toUpperCase()),"SELECT"!==o||r.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),r.selectedIndex=-1)}w(e,t,"selected")},INPUT:function(e,t){w(e,t,"checked"),w(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var r=t.value;e.value!==r&&(e.value=r);var o=e.firstChild;if(o){var a=o.nodeValue;if(a==r||!r&&a==e.placeholder)return;o.nodeValue=r}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var r,o,a=-1,n=0,l=e.firstChild;l;)if("OPTGROUP"===(o=l.nodeName&&l.nodeName.toUpperCase()))(l=(r=l).firstChild)||(l=r.nextSibling,r=null);else{if("OPTION"===o){if(l.hasAttribute("selected")){a=n;break}n++}!(l=l.nextSibling)&&r&&(l=r.nextSibling,r=null)}e.selectedIndex=a}}};function y(){}function j(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var x=function(e,t,r){if(r||(r={}),"string"==typeof t)if("#document"===e.nodeName||"HTML"===e.nodeName){var o=t;(t=u.createElement("html")).innerHTML=o}else if("BODY"===e.nodeName){var a=t;(t=u.createElement("html")).innerHTML=a;var n=t.querySelector("body");n&&(t=n)}else l=(l=t).trim(),t=g?function(e){var t=u.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(l):p?function(e){return b||(b=u.createRange()).selectNode(u.body),b.createContextualFragment(e).childNodes[0]}(l):function(e){var t=u.createElement("body");return t.innerHTML=e,t.childNodes[0]}(l);else 11===t.nodeType&&(t=t.firstElementChild);var l,i=r.getNodeKey||j,s=r.onBeforeNodeAdded||y,d=r.onNodeAdded||y,m=r.onBeforeElUpdated||y,c=r.onElUpdated||y,f=r.onBeforeNodeDiscarded||y,h=r.onNodeDiscarded||y,w=r.onBeforeElChildrenUpdated||y,x=r.skipFromChildren||y,z=r.addChild||function(e,t){return e.appendChild(t)},O=!0===r.childrenOnly,C=Object.create(null),T=[];function N(e){T.push(e)}function q(e,t){if(1===e.nodeType)for(var r=e.firstChild;r;){var o=void 0;t&&(o=i(r))?N(o):(h(r),r.firstChild&&q(r,t)),r=r.nextSibling}}function E(e,t,r){!1!==f(e)&&(t&&t.removeChild(e),h(e),q(e,r))}function P(e){if(1===e.nodeType||11===e.nodeType)for(var t=e.firstChild;t;){var r=i(t);r&&(C[r]=t),P(t),t=t.nextSibling}}function H(e){d(e);for(var t=e.firstChild;t;){var r=t.nextSibling,o=i(t);if(o){var a=C[o];a&&v(t,a)?(t.parentNode.replaceChild(a,t),L(a,t)):H(t)}else H(t);t=r}}function L(e,t,r){var o=i(t);if(o&&delete C[o],!r){var a=m(e,t);if(!1===a)return;if(a instanceof HTMLElement&&P(e=a),function(e,t){var r,o,a,n,l=t.attributes;if(11!==t.nodeType&&11!==e.nodeType){for(var i=l.length-1;i>=0;i--)o=(r=l[i]).name,n=r.value,(a=r.namespaceURI)?e.getAttributeNS(a,o=r.localName||o)!==n&&("xmlns"===r.prefix&&(o=r.name),e.setAttributeNS(a,o,n)):e.getAttribute(o)!==n&&e.setAttribute(o,n);for(var s=e.attributes,d=s.length-1;d>=0;d--)o=(r=s[d]).name,(a=r.namespaceURI)?t.hasAttributeNS(a,o=r.localName||o)||e.removeAttributeNS(a,o):t.hasAttribute(o)||e.removeAttribute(o)}}(e,t),c(e),!1===w(e,t))return}"TEXTAREA"!==e.nodeName?function(e,t){var r,o,a,n,l,d=x(e,t),m=t.firstChild,c=e.firstChild;e:for(;m;){for(n=m.nextSibling,r=i(m);!d&&c;){if(a=c.nextSibling,m.isSameNode&&m.isSameNode(c)){m=n,c=a;continue e}o=i(c);var f=c.nodeType,h=void 0;if(f===m.nodeType&&(1===f?(r?r!==o&&((l=C[r])?a===l?h=!1:(e.insertBefore(l,c),o?N(o):E(c,e,!0),o=i(c=l)):h=!1):o&&(h=!1),(h=!1!==h&&v(c,m))&&L(c,m)):3!==f&&8!=f||(h=!0,c.nodeValue!==m.nodeValue&&(c.nodeValue=m.nodeValue))),h){m=n,c=a;continue e}o?N(o):E(c,e,!0),c=a}if(r&&(l=C[r])&&v(l,m))d||z(e,l),L(l,m);else{var b=s(m);!1!==b&&(b&&(m=b),m.actualize&&(m=m.actualize(e.ownerDocument||u)),z(e,m),H(m))}m=n,c=a}!function(e,t,r){for(;t;){var o=t.nextSibling;(r=i(t))?N(r):E(t,e,!0),t=o}}(e,c,o);var g=k[e.nodeName];g&&g(e,t)}(e,t):k.TEXTAREA(e,t)}P(e);var M,S,I=e,D=I.nodeType,R=t.nodeType;if(!O)if(1===D)1===R?v(e,t)||(h(e),I=function(e,t){for(var r=e.firstChild;r;){var o=r.nextSibling;t.appendChild(r),r=o}return t}(e,(M=t.nodeName,(S=t.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==S?u.createElementNS(S,M):u.createElement(M)))):I=t;else if(3===D||8===D){if(R===D)return I.nodeValue!==t.nodeValue&&(I.nodeValue=t.nodeValue),I;I=t}if(I===t)h(e);else{if(t.isSameNode&&t.isSameNode(I))return;if(L(I,t,O),T)for(var A=0,B=T.length;A<B;A++){var J=C[T[A]];J&&E(J,J.parentNode,!1)}}return!O&&I!==e&&e.parentNode&&(I.actualize&&(I=I.actualize(e.ownerDocument||u)),e.parentNode.replaceChild(I,e)),I};const z=[{tagName:"limel-chip",attributes:["text","icon","link","badge","disabled","readonly","selected","type","size"]},{tagName:"limel-icon",attributes:["name","size","badge"]},{tagName:"limel-badge",attributes:["label"]},{tagName:"limel-callout",attributes:["heading","icon","type"]},{tagName:"limel-linear-progress",attributes:["value","indeterminate"]},{tagName:"limel-circular-progress",attributes:["value","max-value","prefix","suffix","size","display-percentage-colors"]},{tagName:"limel-spinner",attributes:["size"]},{tagName:"limel-info-tile",attributes:["value","icon","label","prefix","suffix","badge"]}],O=class{constructor(t){e(this,t),this.value="",this.whitelist=a.markdownWhitelist,this.lazyLoadImages=!1,this.removeEmptyParagraphs=!0,this.imageIntersectionObserver=null}async textChanged(){try{this.cleanupImageIntersectionObserver(),this.cachedCombinedWhitelist&&this.whitelist===this.cachedConsumerWhitelist||(this.cachedConsumerWhitelist=this.whitelist,this.cachedCombinedWhitelist=function(e,t){if(!(null==t?void 0:t.length))return e.map((e=>Object.assign(Object.assign({},e),{attributes:[...e.attributes]})));const r=new Map;for(const o of[...e,...t]){const e=r.get(o.tagName);if(e)for(const t of o.attributes)e.add(t);else r.set(o.tagName,new Set(o.attributes))}return[...r.entries()].map((([e,t])=>({tagName:e,attributes:[...t]})))}(z,this.whitelist));const e=this.cachedCombinedWhitelist,t=await o(this.value,{forceHardLineBreaks:!0,whitelist:e,lazyLoadImages:this.lazyLoadImages,removeEmptyParagraphs:this.removeEmptyParagraphs});!function(e,t=""){try{x(e,`<div>${t}</div>`,{childrenOnly:!0})}catch(r){console.warn("morphdom failed, falling back to innerHTML:",r),e.innerHTML=t}}(this.rootElement,t),function(e,t){if(e&&(null==t?void 0:t.length))for(const r of t){const t=e.querySelectorAll(r.tagName);for(const e of t)d(e,r.attributes)}}(this.rootElement,e),this.setupImageIntersectionObserver()}catch(e){console.error(e)}}handleWhitelistChange(){return this.textChanged()}handleRemoveEmptyParagraphsChange(){return this.textChanged()}async componentDidLoad(){this.textChanged()}disconnectedCallback(){this.cleanupImageIntersectionObserver()}render(){return t(r,{key:"9d88a42e047b6701215699ab5459af3275e51693"},t("div",{key:"83a5801839318bf47eeacbf53e320e4628559bfa",id:"markdown",ref:e=>this.rootElement=e}))}setupImageIntersectionObserver(){this.lazyLoadImages&&(this.imageIntersectionObserver=new l(this.rootElement))}cleanupImageIntersectionObserver(){this.imageIntersectionObserver&&(this.imageIntersectionObserver.disconnect(),this.imageIntersectionObserver=null)}static get watchers(){return{value:[{textChanged:0}],whitelist:[{handleWhitelistChange:0}],removeEmptyParagraphs:[{handleRemoveEmptyParagraphsChange:0}]}}};O.style='@charset "UTF-8";pre,pre p,code{font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-size:0.75rem}pre{max-width:100%;white-space:pre-wrap;word-wrap:break-word}code{letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));tab-size:4;hyphens:none;display:inline;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:var(--limel-theme-default-font-size)}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:var(--limel-theme-default-font-size);word-break:break-word}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:only-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}ul{list-style:none}ul li{position:relative;margin-left:0.75rem}ul li:before{content:"";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{margin-bottom:0.25rem}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0}:host(limel-markdown:not(.no-table-styles)) tbody{border:1px solid rgb(var(--contrast-400));border-radius:0.25rem}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:var(--limel-theme-default-font-size)}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}table{display:block;box-sizing:border-box;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}blockquote{position:relative;max-width:100%;margin:0.75rem 0;padding:0.5rem;border-left:0.25rem solid rgb(var(--contrast-500));background-color:rgb(var(--contrast-200))}blockquote:before,blockquote:after{position:absolute;line-height:0;font-size:2rem;opacity:0.4}blockquote:before{content:"“";left:-0.5rem;top:0.5rem}blockquote:after{content:"”";right:-0.25rem;bottom:-0.25rem}blockquote blockquote{padding-top:0;padding-right:0;padding-bottom:0;padding-left:0.25rem;border-color:rgb(var(--contrast-700));border-left-width:1px}blockquote blockquote:before,blockquote blockquote:after{display:none}blockquote:has(>blockquote){padding-left:0.25rem;padding-bottom:0}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:var(--limel-theme-default-font-size);margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}img{max-width:100%;border-radius:0.25rem}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-markdown.adjust-for-table-cell) img{max-height:1.25rem;vertical-align:middle}:host(limel-markdown.adjust-for-table-cell) p{display:inline}:host(limel-markdown.adjust-for-table-cell) h1,:host(limel-markdown.adjust-for-table-cell) h2,:host(limel-markdown.adjust-for-table-cell) h3,:host(limel-markdown.adjust-for-table-cell) h4,:host(limel-markdown.adjust-for-table-cell) h5,:host(limel-markdown.adjust-for-table-cell) h6{display:inline-block;vertical-align:bottom;font-size:var(--limel-theme-default-font-size);margin:0 0.25rem 0 0;letter-spacing:normal;font-weight:500}:host(limel-markdown.adjust-for-table-cell) h1:before,:host(limel-markdown.adjust-for-table-cell) h2:before,:host(limel-markdown.adjust-for-table-cell) h3:before,:host(limel-markdown.adjust-for-table-cell) h4:before,:host(limel-markdown.adjust-for-table-cell) h5:before,:host(limel-markdown.adjust-for-table-cell) h6:before{opacity:0.6;vertical-align:middle;font-size:0.5rem;border-radius:0.25rem 0 0 0.25rem;padding:0.25rem;padding-right:2rem;margin-right:-1.75rem;background:linear-gradient(to right, rgb(var(--contrast-800), 0.6), rgb(var(--contrast-800), 0))}:host(limel-markdown.adjust-for-table-cell) h1:before{content:"H1"}:host(limel-markdown.adjust-for-table-cell) h2:before{content:"H2"}:host(limel-markdown.adjust-for-table-cell) h3:before{content:"H3"}:host(limel-markdown.adjust-for-table-cell) h4:before{content:"H4"}:host(limel-markdown.adjust-for-table-cell) h5:before{content:"H5"}:host(limel-markdown.adjust-for-table-cell) h6:before{content:"H6"}:host(limel-markdown.adjust-for-table-cell) pre{margin:0}:host(limel-markdown.adjust-for-table-cell) pre>code{padding:0.125rem;margin:0}:host(limel-markdown.adjust-for-table-cell) dl{margin:0}:host(limel-markdown.adjust-for-table-cell) dl dt,:host(limel-markdown.adjust-for-table-cell) dl dd{padding:0.00625rem 0.125rem}*,*::before,*::after{box-sizing:border-box}* :where(:not(img,video,svg,canvas,iframe)),*::before :where(:not(img,video,svg,canvas,iframe)),*::after :where(:not(img,video,svg,canvas,iframe)){min-width:0;min-height:0}hr{border-top:1px solid rgb(var(--contrast-700))}.MsoNormal{margin:0}:host(limel-markdown.reset-img-height) #markdown img{height:auto}';export{O as limel_markdown}
|
|
1
|
+
import{r as e,h as t,H as r}from"./p-DBTJNfo7.js";import{m as o}from"./p-DdYOzHlg.js";import{g as a}from"./p-Dnt5w_Bp.js";import{d as n}from"./p-DJvGLFul.js";import"./p-B85MJLTf.js";class l{constructor(e){this.handleIntersection=e=>{for(const t of e)if(t.isIntersecting){const e=t.target,r=e.dataset.src;r&&(e.setAttribute("src",r),delete e.dataset.src),this.observer.unobserve(e)}},this.observer=new IntersectionObserver(this.handleIntersection);const t=e.querySelectorAll("img");for(const e of t)this.observer.observe(e)}disconnect(){this.observer.disconnect()}}var i;const s=new Map(Object.entries(null!==(i=n.protocols)&&void 0!==i?i:{}).map((([e,t])=>[e,new Set(t)])));function d(e,t){for(const r of t){const t=e.getAttribute(r);if(!t)continue;const o=m(t);if(void 0!==o){const t=h(o);e[f(r)]=t}}}function m(e){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch(e){try{const e=t.replaceAll(""",'"').replaceAll(""",'"').replaceAll(""",'"').replaceAll("'","'").replaceAll("'","'").replaceAll("'","'").replaceAll("&","&");return JSON.parse(e)}catch(e){return}}}function c(e,t){const r=e.trim(),o=r.indexOf(":");if(-1===o||/[?#/]/.test(r.slice(0,o)))return!0;const a=r.slice(0,o).toLowerCase();return t.has(a)}function h(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(h);const t=Object.assign({},e);for(const e of Object.keys(t)){const r=s.get(e);r&&"string"==typeof t[e]&&!c(t[e],r)?(console.warn(`limel-markdown: Removed unsafe URL from "${e}" during sanitization.`),delete t[e]):"object"==typeof t[e]&&null!==t[e]&&(t[e]=h(t[e]))}return t}function f(e){return e.replaceAll(/-([a-z])/g,((e,t)=>t.toUpperCase()))}var b,u="undefined"==typeof document?void 0:document,g=!!u&&"content"in u.createElement("template"),p=!!u&&u.createRange&&"createContextualFragment"in u.createRange();function v(e,t){var r,o,a=e.nodeName,n=t.nodeName;return a===n||(r=a.charCodeAt(0),o=n.charCodeAt(0),r<=90&&o>=97?a===n.toUpperCase():o<=90&&r>=97&&n===a.toUpperCase())}function w(e,t,r){e[r]!==t[r]&&(e[r]=t[r],e[r]?e.setAttribute(r,""):e.removeAttribute(r))}var k={OPTION:function(e,t){var r=e.parentNode;if(r){var o=r.nodeName.toUpperCase();"OPTGROUP"===o&&(o=(r=r.parentNode)&&r.nodeName.toUpperCase()),"SELECT"!==o||r.hasAttribute("multiple")||(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),r.selectedIndex=-1)}w(e,t,"selected")},INPUT:function(e,t){w(e,t,"checked"),w(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var r=t.value;e.value!==r&&(e.value=r);var o=e.firstChild;if(o){var a=o.nodeValue;if(a==r||!r&&a==e.placeholder)return;o.nodeValue=r}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var r,o,a=-1,n=0,l=e.firstChild;l;)if("OPTGROUP"===(o=l.nodeName&&l.nodeName.toUpperCase()))(l=(r=l).firstChild)||(l=r.nextSibling,r=null);else{if("OPTION"===o){if(l.hasAttribute("selected")){a=n;break}n++}!(l=l.nextSibling)&&r&&(l=r.nextSibling,r=null)}e.selectedIndex=a}}};function y(){}function j(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}var x=function(e,t,r){if(r||(r={}),"string"==typeof t)if("#document"===e.nodeName||"HTML"===e.nodeName){var o=t;(t=u.createElement("html")).innerHTML=o}else if("BODY"===e.nodeName){var a=t;(t=u.createElement("html")).innerHTML=a;var n=t.querySelector("body");n&&(t=n)}else l=(l=t).trim(),t=g?function(e){var t=u.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}(l):p?function(e){return b||(b=u.createRange()).selectNode(u.body),b.createContextualFragment(e).childNodes[0]}(l):function(e){var t=u.createElement("body");return t.innerHTML=e,t.childNodes[0]}(l);else 11===t.nodeType&&(t=t.firstElementChild);var l,i=r.getNodeKey||j,s=r.onBeforeNodeAdded||y,d=r.onNodeAdded||y,m=r.onBeforeElUpdated||y,c=r.onElUpdated||y,h=r.onBeforeNodeDiscarded||y,f=r.onNodeDiscarded||y,w=r.onBeforeElChildrenUpdated||y,x=r.skipFromChildren||y,z=r.addChild||function(e,t){return e.appendChild(t)},O=!0===r.childrenOnly,C=Object.create(null),T=[];function N(e){T.push(e)}function q(e,t){if(1===e.nodeType)for(var r=e.firstChild;r;){var o=void 0;t&&(o=i(r))?N(o):(f(r),r.firstChild&&q(r,t)),r=r.nextSibling}}function E(e,t,r){!1!==h(e)&&(t&&t.removeChild(e),f(e),q(e,r))}function P(e){if(1===e.nodeType||11===e.nodeType)for(var t=e.firstChild;t;){var r=i(t);r&&(C[r]=t),P(t),t=t.nextSibling}}function H(e){d(e);for(var t=e.firstChild;t;){var r=t.nextSibling,o=i(t);if(o){var a=C[o];a&&v(t,a)?(t.parentNode.replaceChild(a,t),L(a,t)):H(t)}else H(t);t=r}}function L(e,t,r){var o=i(t);if(o&&delete C[o],!r){var a=m(e,t);if(!1===a)return;if(a instanceof HTMLElement&&P(e=a),function(e,t){var r,o,a,n,l=t.attributes;if(11!==t.nodeType&&11!==e.nodeType){for(var i=l.length-1;i>=0;i--)o=(r=l[i]).name,n=r.value,(a=r.namespaceURI)?e.getAttributeNS(a,o=r.localName||o)!==n&&("xmlns"===r.prefix&&(o=r.name),e.setAttributeNS(a,o,n)):e.getAttribute(o)!==n&&e.setAttribute(o,n);for(var s=e.attributes,d=s.length-1;d>=0;d--)o=(r=s[d]).name,(a=r.namespaceURI)?t.hasAttributeNS(a,o=r.localName||o)||e.removeAttributeNS(a,o):t.hasAttribute(o)||e.removeAttribute(o)}}(e,t),c(e),!1===w(e,t))return}"TEXTAREA"!==e.nodeName?function(e,t){var r,o,a,n,l,d=x(e,t),m=t.firstChild,c=e.firstChild;e:for(;m;){for(n=m.nextSibling,r=i(m);!d&&c;){if(a=c.nextSibling,m.isSameNode&&m.isSameNode(c)){m=n,c=a;continue e}o=i(c);var h=c.nodeType,f=void 0;if(h===m.nodeType&&(1===h?(r?r!==o&&((l=C[r])?a===l?f=!1:(e.insertBefore(l,c),o?N(o):E(c,e,!0),o=i(c=l)):f=!1):o&&(f=!1),(f=!1!==f&&v(c,m))&&L(c,m)):3!==h&&8!=h||(f=!0,c.nodeValue!==m.nodeValue&&(c.nodeValue=m.nodeValue))),f){m=n,c=a;continue e}o?N(o):E(c,e,!0),c=a}if(r&&(l=C[r])&&v(l,m))d||z(e,l),L(l,m);else{var b=s(m);!1!==b&&(b&&(m=b),m.actualize&&(m=m.actualize(e.ownerDocument||u)),z(e,m),H(m))}m=n,c=a}!function(e,t,r){for(;t;){var o=t.nextSibling;(r=i(t))?N(r):E(t,e,!0),t=o}}(e,c,o);var g=k[e.nodeName];g&&g(e,t)}(e,t):k.TEXTAREA(e,t)}P(e);var M,S,I=e,D=I.nodeType,R=t.nodeType;if(!O)if(1===D)1===R?v(e,t)||(f(e),I=function(e,t){for(var r=e.firstChild;r;){var o=r.nextSibling;t.appendChild(r),r=o}return t}(e,(M=t.nodeName,(S=t.namespaceURI)&&"http://www.w3.org/1999/xhtml"!==S?u.createElementNS(S,M):u.createElement(M)))):I=t;else if(3===D||8===D){if(R===D)return I.nodeValue!==t.nodeValue&&(I.nodeValue=t.nodeValue),I;I=t}if(I===t)f(e);else{if(t.isSameNode&&t.isSameNode(I))return;if(L(I,t,O),T)for(var A=0,B=T.length;A<B;A++){var J=C[T[A]];J&&E(J,J.parentNode,!1)}}return!O&&I!==e&&e.parentNode&&(I.actualize&&(I=I.actualize(e.ownerDocument||u)),e.parentNode.replaceChild(I,e)),I};const z=[{tagName:"limel-chip",attributes:["text","icon","link","badge","disabled","readonly","selected","type","size"]},{tagName:"limel-icon",attributes:["name","size","badge"]},{tagName:"limel-badge",attributes:["label"]},{tagName:"limel-callout",attributes:["heading","icon","type"]},{tagName:"limel-linear-progress",attributes:["value","indeterminate"]},{tagName:"limel-circular-progress",attributes:["value","max-value","prefix","suffix","size","display-percentage-colors"]},{tagName:"limel-spinner",attributes:["size"]},{tagName:"limel-info-tile",attributes:["value","icon","label","prefix","suffix","badge"]}],O=class{constructor(t){e(this,t),this.value="",this.whitelist=a.markdownWhitelist,this.lazyLoadImages=!1,this.removeEmptyParagraphs=!0,this.imageIntersectionObserver=null}async textChanged(){try{this.cleanupImageIntersectionObserver(),this.cachedCombinedWhitelist&&this.whitelist===this.cachedConsumerWhitelist||(this.cachedConsumerWhitelist=this.whitelist,this.cachedCombinedWhitelist=function(e,t){if(!(null==t?void 0:t.length))return e.map((e=>Object.assign(Object.assign({},e),{attributes:[...e.attributes]})));const r=new Map;for(const o of[...e,...t]){const e=r.get(o.tagName);if(e)for(const t of o.attributes)e.add(t);else r.set(o.tagName,new Set(o.attributes))}return[...r.entries()].map((([e,t])=>({tagName:e,attributes:[...t]})))}(z,this.whitelist));const e=this.cachedCombinedWhitelist,t=await o(this.value,{forceHardLineBreaks:!0,whitelist:e,lazyLoadImages:this.lazyLoadImages,removeEmptyParagraphs:this.removeEmptyParagraphs});!function(e,t=""){try{x(e,`<div>${t}</div>`,{childrenOnly:!0})}catch(r){console.warn("morphdom failed, falling back to innerHTML:",r),e.innerHTML=t}}(this.rootElement,t),function(e,t){if(e&&(null==t?void 0:t.length))for(const r of t){const t=e.querySelectorAll(r.tagName);for(const e of t)d(e,r.attributes)}}(this.rootElement,e),this.setupImageIntersectionObserver()}catch(e){console.error(e)}}handleWhitelistChange(){return this.textChanged()}handleRemoveEmptyParagraphsChange(){return this.textChanged()}async componentDidLoad(){this.textChanged()}disconnectedCallback(){this.cleanupImageIntersectionObserver()}render(){return t(r,{key:"9d88a42e047b6701215699ab5459af3275e51693"},t("div",{key:"83a5801839318bf47eeacbf53e320e4628559bfa",id:"markdown",ref:e=>this.rootElement=e}))}setupImageIntersectionObserver(){this.lazyLoadImages&&(this.imageIntersectionObserver=new l(this.rootElement))}cleanupImageIntersectionObserver(){this.imageIntersectionObserver&&(this.imageIntersectionObserver.disconnect(),this.imageIntersectionObserver=null)}static get watchers(){return{value:[{textChanged:0}],whitelist:[{handleWhitelistChange:0}],removeEmptyParagraphs:[{handleRemoveEmptyParagraphsChange:0}]}}};O.style='@charset "UTF-8";pre,pre p,code{font-family:ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;font-size:0.75rem}pre{max-width:100%;white-space:pre-wrap;word-wrap:break-word}code{letter-spacing:-0.0125rem;color:rgb(var(--contrast-1300));tab-size:4;hyphens:none;display:inline;border-radius:0.25rem;padding:0.03125rem 0.25rem;background-color:rgb(var(--contrast-600))}pre>code{display:block;margin:0.5rem 0;padding:0.5rem 0.75rem}h1{font-size:1.5rem}h2{font-size:1.25rem}h3{font-size:1.125rem}h4{font-size:1rem}h5{font-size:var(--limel-theme-default-font-size)}h6{font-size:0.75rem}h1,h2{margin-top:0.5rem;margin-bottom:0.5rem;letter-spacing:-0.03125rem;font-weight:500}h3,h4{margin-top:0.75rem;margin-bottom:0.25rem;font-weight:600}h5,h6{margin-top:0.5rem;margin-bottom:0.125rem;font-weight:600}h1,h2,h3,h4,h5,h6{word-break:break-word;hyphens:auto;-webkit-hyphens:auto}h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{font-size:inherit}:not([contenteditable=true]) h1,:not([contenteditable=true]) h2,:not([contenteditable=true]) h3,:not([contenteditable=true]) h4,:not([contenteditable=true]) h5,:not([contenteditable=true]) h6{text-wrap:balance}[contenteditable=true] h1,[contenteditable=true] h2,[contenteditable=true] h3,[contenteditable=true] h4,[contenteditable=true] h5,[contenteditable=true] h6{text-wrap:initial}:host(limel-markdown.truncate-paragraphs) p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}p,li{font-size:var(--limel-theme-default-font-size);word-break:break-word}a{word-break:break-all}p{margin-top:0;margin-bottom:0.5rem}p:last-child{margin-bottom:0}a{transition:color 0.2s ease;color:var(--markdown-hyperlink-color, rgb(var(--color-blue-dark)));text-decoration:none}a:hover{color:var(--markdown-hyperlink-color--hovered, rgb(var(--color-blue-default)))}hr{margin:1.75rem 0 2rem 0;border-width:0;border-top:1px solid rgb(var(--contrast-500))}ul{list-style:none}ul li{position:relative;margin-left:0.75rem}ul li:before{content:"";position:absolute;left:-0.5rem;top:0.5rem;width:0.25rem;height:0.25rem;border-radius:50%;background-color:rgb(var(--contrast-700));display:block}ol{margin-top:0.25rem;padding-left:1rem}ul{margin-top:0.25rem;padding-left:0}ul ul,ul ol,ol ol,ol ul{margin-left:0}li{margin-bottom:0.25rem}:host(limel-markdown:not(.no-table-styles)) table{table-layout:auto;min-width:100%;border-collapse:collapse;border-spacing:0;background:transparent;margin:0.75rem 0}:host(limel-markdown:not(.no-table-styles)) tbody{border:1px solid rgb(var(--contrast-400));border-radius:0.25rem}:host(limel-markdown:not(.no-table-styles)) th,:host(limel-markdown:not(.no-table-styles)) td{text-align:left;vertical-align:top;transition:background-color 0.2s ease;font-size:var(--limel-theme-default-font-size)}:host(limel-markdown:not(.no-table-styles)) th p,:host(limel-markdown:not(.no-table-styles)) th li,:host(limel-markdown:not(.no-table-styles)) th a,:host(limel-markdown:not(.no-table-styles)) td p,:host(limel-markdown:not(.no-table-styles)) td li,:host(limel-markdown:not(.no-table-styles)) td a{word-break:normal;overflow-wrap:normal}:host(limel-markdown:not(.no-table-styles)) td{padding:0.5rem 0.375rem 0.75rem 0.375rem}:host(limel-markdown:not(.no-table-styles)) tr th{background-color:rgb(var(--contrast-400));padding:0.25rem 0.375rem;font-weight:normal}:host(limel-markdown:not(.no-table-styles)) tr th:only-child{text-align:center}:host(limel-markdown:not(.no-table-styles)) tbody tr:nth-child(odd) td{background-color:rgb(var(--contrast-200))}:host(limel-markdown:not(.no-table-styles)) tbody tr:hover td{background-color:rgb(var(--contrast-300))}table{display:block;box-sizing:border-box;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}blockquote{position:relative;max-width:100%;margin:0.75rem 0;padding:0.5rem;border-left:0.25rem solid rgb(var(--contrast-500));background-color:rgb(var(--contrast-200))}blockquote:before,blockquote:after{position:absolute;line-height:0;font-size:2rem;opacity:0.4}blockquote:before{content:"“";left:-0.5rem;top:0.5rem}blockquote:after{content:"”";right:-0.25rem;bottom:-0.25rem}blockquote blockquote{padding-top:0;padding-right:0;padding-bottom:0;padding-left:0.25rem;border-color:rgb(var(--contrast-700));border-left-width:1px}blockquote blockquote:before,blockquote blockquote:after{display:none}blockquote:has(>blockquote){padding-left:0.25rem;padding-bottom:0}dl{display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr;margin-bottom:2rem;border:1px solid rgb(var(--contrast-400));border-radius:0.375rem;background-color:rgb(var(--contrast-200))}dl dt,dl dd{padding:0.375rem 0.5rem;font-size:var(--limel-theme-default-font-size);margin:0}dl dt:nth-of-type(even),dl dd:nth-of-type(even){background-color:rgb(var(--contrast-300))}dl dt:first-child{border-top-left-radius:0.375rem}dl dt:last-child{border-bottom-left-radius:0.375rem}dl dd:first-child{border-top-right-radius:0.375rem}dl dd:last-child{border-bottom-right-radius:0.375rem}img{max-width:100%;border-radius:0.25rem}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-markdown.adjust-for-table-cell) img{max-height:1.25rem;vertical-align:middle}:host(limel-markdown.adjust-for-table-cell) p{display:inline}:host(limel-markdown.adjust-for-table-cell) h1,:host(limel-markdown.adjust-for-table-cell) h2,:host(limel-markdown.adjust-for-table-cell) h3,:host(limel-markdown.adjust-for-table-cell) h4,:host(limel-markdown.adjust-for-table-cell) h5,:host(limel-markdown.adjust-for-table-cell) h6{display:inline-block;vertical-align:bottom;font-size:var(--limel-theme-default-font-size);margin:0 0.25rem 0 0;letter-spacing:normal;font-weight:500}:host(limel-markdown.adjust-for-table-cell) h1:before,:host(limel-markdown.adjust-for-table-cell) h2:before,:host(limel-markdown.adjust-for-table-cell) h3:before,:host(limel-markdown.adjust-for-table-cell) h4:before,:host(limel-markdown.adjust-for-table-cell) h5:before,:host(limel-markdown.adjust-for-table-cell) h6:before{opacity:0.6;vertical-align:middle;font-size:0.5rem;border-radius:0.25rem 0 0 0.25rem;padding:0.25rem;padding-right:2rem;margin-right:-1.75rem;background:linear-gradient(to right, rgb(var(--contrast-800), 0.6), rgb(var(--contrast-800), 0))}:host(limel-markdown.adjust-for-table-cell) h1:before{content:"H1"}:host(limel-markdown.adjust-for-table-cell) h2:before{content:"H2"}:host(limel-markdown.adjust-for-table-cell) h3:before{content:"H3"}:host(limel-markdown.adjust-for-table-cell) h4:before{content:"H4"}:host(limel-markdown.adjust-for-table-cell) h5:before{content:"H5"}:host(limel-markdown.adjust-for-table-cell) h6:before{content:"H6"}:host(limel-markdown.adjust-for-table-cell) pre{margin:0}:host(limel-markdown.adjust-for-table-cell) pre>code{padding:0.125rem;margin:0}:host(limel-markdown.adjust-for-table-cell) dl{margin:0}:host(limel-markdown.adjust-for-table-cell) dl dt,:host(limel-markdown.adjust-for-table-cell) dl dd{padding:0.00625rem 0.125rem}*,*::before,*::after{box-sizing:border-box}* :where(:not(img,video,svg,canvas,iframe)),*::before :where(:not(img,video,svg,canvas,iframe)),*::after :where(:not(img,video,svg,canvas,iframe)){min-width:0;min-height:0}hr{border-top:1px solid rgb(var(--contrast-700))}.MsoNormal{margin:0}:host(limel-markdown.reset-img-height) #markdown img{height:auto}';export{O as limel_markdown}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as e,H as i,a as n}from"./p-DBTJNfo7.js";import{t as r,n as o}from"./p-BxrRWYts.js";import{c as a}from"./p-B-tmXAXV.js";import{c as s}from"./p-JbKhhoXs.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:"ab1b9d31080740d19a4633c8c5bc92b02625c111","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",v="end",b="viewport",y="popper",g=p.reduce((function(t,e){return t.concat([e+"-"+m,e+"-"+v])}),[]),w=[].concat(p,[d]).reduce((function(t,e){return t.concat([e,e+"-"+m,e+"-"+v])}),[]),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,P=Math.round;function S(){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(S())}function W(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&&P(n.width)/t.offsetWidth||1,o=t.offsetHeight>0&&P(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 L(t){var e=W(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 D(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 E(t){return k(t).getComputedStyle(t)}function T(t){return["table","td","th"].indexOf(O(t))>=0}function z(t){return((j(t)?t.ownerDocument:t.document)||window.document).documentElement}function R(t){return"html"===O(t)?t:t.assignedSlot||t.parentNode||(N(t)?t.host:null)||z(t)}function H(t){return C(t)&&"fixed"!==E(t).position?t.offsetParent:null}function q(t){for(var e=k(t),i=H(t);i&&T(i)&&"static"===E(i).position;)i=H(i);return i&&("html"===O(i)||"body"===O(i)&&"static"===E(i).position)?e:i||function(t){var e=/firefox/i.test(S());if(/Trident/i.test(S())&&C(t)&&"fixed"===E(t).position)return null;var i=R(t);for(N(i)&&(i=i.host);C(i)&&["html","body"].indexOf(O(i))<0;){var n=E(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 _(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function I(t,e,i){return M(t,A(e,i))}function V(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function $(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}function F(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,b=a.x,y=void 0===b?0:b,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=q(i),A="clientHeight",S="clientWidth";M===k(i)&&"static"!==E(M=z(i)).position&&"absolute"===s&&(A="scrollHeight",S="scrollWidth"),(r===c||(r===f||r===h)&&o===v)&&(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!==v)||(C=h,y-=(m&&M===G&&G.visualViewport?G.visualViewport.width:M[S])-n.width,y*=l?1:-1)}var B,W=Object.assign({position:s},d&&U),L=!0===p?function(t,e){var i=t.y,n=e.devicePixelRatio||1;return{x:P(t.x*n)/n||0,y:P(i*n)/n||0}}({x:y,y:w},k(i)):{x:y,y:w};return y=L.x,w=L.y,Object.assign({},W,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 Y(t){return t.replace(/left|right|bottom|top/g,(function(t){return K[t]}))}var Q={start:"end",end:"start"};function Z(t){return t.replace(/start|end/g,(function(t){return Q[t]}))}function tt(t){var e=k(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function et(t){return W(z(t)).left+tt(t).scrollLeft}function it(t){var e=E(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(R(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(R(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===b?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=W(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"===E(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?F(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?_(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 v: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?b:l,d=e.elementContext,m=void 0===d?y:d,v=e.altBoundary,g=void 0!==v&&v,w=e.padding,x=void 0===w?0:w,k=V("number"!=typeof x?x:$(x,p)),N=t.rects.popper,G=t.elements[g?m===y?"reference":y:m],P=function(t,e,i,n){var r="clippingParents"===e?function(t){var e=rt(R(t)),i=["absolute","fixed"].indexOf(E(t).position)>=0&&C(t)?q(t):t;return j(i)?e.filter((function(t){return j(t)&&D(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),S=W(t.elements.reference),B=st({reference:S,element:N,placement:n}),L=ot(Object.assign({},N,B)),T=m===y?L:S,H={top:P.top-T.top+k.top,bottom:T.bottom-P.bottom+k.bottom,left:P.left-T.left+k.left,right:T.right-P.right+k.right},_=t.modifiersData.offset;if(m===y&&_){var I=_[n];Object.keys(H).forEach((function(t){var e=[h,u].indexOf(t)>=0?1:-1,i=[c,u].indexOf(t)>=0?"y":"x";H[t]+=I[i]*e}))}return H}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=F(e.placement),c=l?o?g:g.filter((function(t){return F(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,v=i.boundary,b=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=Y(t);return[Z(t),e,Z(e)]}(O):[Y(O)]),C=[O].concat(j).reduce((function(t,i){return t.concat(G(i)===d?ct(e,{placement:i,boundary:v,rootBoundary:b,padding:p,flipVariations:w,allowedAutoPlacements:x}):i)}),[]),N=e.rects.reference,M=e.rects.popper,A=new Map,P=!0,S=C[0],B=0;B<C.length;B++){var W=C[B],L=G(W),D=F(W)===m,E=[c,u].indexOf(L)>=0,T=E?"width":"height",z=lt(e,{placement:W,boundary:v,rootBoundary:b,altBoundary:y,padding:p}),R=E?D?h:f:D?u:c;N[T]>M[T]&&(R=Y(R));var H=Y(R),q=[];if(o&&q.push(z[L]<=0),s&&q.push(z[R]<=0,z[H]<=0),q.every((function(t){return t}))){S=W,P=!1;break}A.set(W,q)}if(P)for(var _=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 S=e,"break"},I=w?3:1;I>0&&"break"!==_(I);I--);e.placement!==S&&(e.modifiersData[n]._skip=!0,e.placement=S,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=P(e.width)/t.offsetWidth||1,n=P(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),s=z(e),l=W(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=W(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 vt(){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 bt(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(vt(e,i)){s.rects={reference:dt(e,q(i),"fixed"===s.options.strategy),popper:L(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(!vt(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=bt({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:F(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,v=void 0===p?0:p,b=lt(e,{boundary:i.boundary,rootBoundary:i.rootBoundary,padding:i.padding,altBoundary:i.altBoundary}),y=G(e.placement),g=F(e.placement),w=!g,x=_(y),O="x"===x?"y":"x",k=e.modifiersData.popperOffsets,j=e.rects.reference,C=e.rects.popper,N="function"==typeof v?v(Object.assign({},e.rects,{placement:e.placement})):v,P="number"==typeof N?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),S=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,B={x:0,y:0};if(k){if(o){var W,D="y"===x?c:f,E="y"===x?u:h,T="y"===x?"height":"width",z=k[x],R=z+b[D],H=z-b[E],V=d?-C[T]/2:0,$=g===m?j[T]:C[T],U=g===m?-C[T]:-j[T],X=e.elements.arrow,J=d&&X?L(X):{width:0,height:0},K=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},Y=K[D],Q=K[E],Z=I(0,j[T],J[T]),tt=w?j[T]/2-V-Z-Y-P.mainAxis:$-Z-Y-P.mainAxis,et=w?-j[T]/2+V+Z+Q+P.mainAxis:U+Z+Q+P.mainAxis,it=e.elements.arrow&&q(e.elements.arrow),nt=null!=(W=null==S?void 0:S[x])?W:0,rt=z+et-nt,ot=I(d?A(R,z+tt-nt-(it?"y"===x?it.clientTop||0:it.clientLeft||0:0)):R,z,d?M(H,rt):H);k[x]=ot,B[x]=ot-z}if(s){var at,st=k[O],ct="y"===O?"height":"width",ut=st+b["x"===x?c:f],ht=st-b["x"===x?u:h],ft=-1!==[c,f].indexOf(y),dt=null!=(at=null==S?void 0:S[O])?at:0,pt=ft?ut:st-j[ct]-C[ct]-dt+P.altAxis,mt=ft?st+j[ct]+C[ct]-dt-P.altAxis:ht,vt=d&&ft?function(t,e,i){var n=I(t,e,i);return n>i?i:n}(pt,st,mt):I(d?pt:ut,st,d?mt:ht);k[O]=vt,B[O]=vt-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=_(s),d=[f,h].indexOf(s)>=0?"height":"width";if(o&&a){var m=function(t,e){return V("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:$(t,p))}(r.padding,i),v=L(o),b="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=q(o),O=x?"y"===l?x.clientHeight||0:x.clientWidth||0:0,k=O/2-v[d]/2+(g/2-w/2),j=I(m[b],k,O-v[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)))&&D(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{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.parents=new WeakMap}disconnectedCallback(){this.removeContainer(),this.destroyPopper(),this.observer&&this.container&&this.observer.unobserve(this.container),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()),"ResizeObserver"in window&&(this.observer=new ResizeObserver((()=>{this.popperInstance&&(this.styleContainer(),this.popperInstance.update())})),this.observer.observe(this.container)))}render(){return e("slot",{key:"c8e7ba60cdab45dd239eae6c9123f673a48e8e22"})}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.container=document.createElement("div"),this.container.setAttribute("id",this.containerId),this.container.setAttribute("class","limel-portal--container"),Object.assign(this.container,{portalSource:this.host}),e.forEach((t=>{this.parents.set(t,t.parentElement),this.container.append(t)}))}attachContainer(){this.getParent().append(this.container)}removeContainer(){this.container&&([...this.container.children].forEach((t=>{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(){this.setContainerWidth(),this.setContainerHeight(),this.setContainerStyles()}setContainerWidth(){const t=this.host.getBoundingClientRect().width;if(this.inheritParentWidth){let e=this.getContentWidth(this.container);t>0&&(e=t),this.container.style.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 of Object.keys(this.containerStyle))this.container.style[t]=this.containerStyle[t]}createPopper(){const t=this.createPopperConfig();this.popperInstance=yt(this.anchor||this.host,this.container,t)}destroyPopper(){var t;null===(t=this.popperInstance)||void 0===t||t.destroy(),this.popperInstance=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(){const t=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0),{top:e,bottom:i}=this.host.getBoundingClientRect(),n=Math.max(e,0),r=Math.max(t-i,0),o=Math.max(n,r)-16;this.container.style.maxHeight=`${o}px`}getParent(){let t=this.anchor||this.host;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:"a88bd5dddfd5cd3170365e059681c71714ea44d8",class:"trigger-anchor"},e("limel-portal",{key:"f267863a5e88bdceade994b7ed359d8009676fe2",openDirection:this.openDirection,visible:this.open,containerId:this.portalId,containerStyle:{"z-index":t,"pointer-events":"none"},anchor:this.ownerElement},e("limel-tooltip-content",{key:"8a58395071b2017fa1dd100899002eec67156750",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:"3994a2ea4040dfd7dfa969a3347d111994d769e1",class:{"has-column-layout":t},style:this.maxlength?{"--tooltip-max-width-of-text":`${this.maxlength}ch`}:void 0},e("div",{key:"8a7cfd75957eea1515a22928f4783f787f1288bc",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}
|
|
@@ -16,6 +16,12 @@ export declare class TooltipContent {
|
|
|
16
16
|
* Read more in tooltip.tsx
|
|
17
17
|
*/
|
|
18
18
|
maxlength?: number;
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Read more in tooltip.tsx
|
|
21
|
+
*/
|
|
22
|
+
hotkey?: string;
|
|
23
|
+
render(): any;
|
|
24
|
+
private renderHelperLabel;
|
|
25
|
+
private renderHotkey;
|
|
20
26
|
}
|
|
21
27
|
//# sourceMappingURL=tooltip-content.d.ts.map
|
|
@@ -14,18 +14,6 @@ import { OpenDirection } from '../menu/menu.types';
|
|
|
14
14
|
* itself is interactive, it will remain interactible even with a tooltip bound
|
|
15
15
|
* to it.
|
|
16
16
|
*
|
|
17
|
-
* :::note
|
|
18
|
-
* In order to display the tooltip, the tooltip element and its trigger element
|
|
19
|
-
* must be within the same document or document fragment (the same shadowRoot).
|
|
20
|
-
* Often, it's easiest to just place them next to each other like in the example
|
|
21
|
-
* below, but if you need to, you can place them differently.
|
|
22
|
-
*
|
|
23
|
-
* ```html
|
|
24
|
-
* <limel-button icon="search" id="tooltip-example" />
|
|
25
|
-
* <limel-tooltip label="Search" elementId="tooltip-example" />
|
|
26
|
-
* ```
|
|
27
|
-
* :::
|
|
28
|
-
*
|
|
29
17
|
* ## Usage
|
|
30
18
|
* - Keep in mind that tooltips can be distracting, and can be perceived as an interruption.
|
|
31
19
|
* Use them only when they add significant value.
|
|
@@ -42,6 +30,8 @@ import { OpenDirection } from '../menu/menu.types';
|
|
|
42
30
|
*
|
|
43
31
|
* @exampleComponent limel-example-tooltip-basic
|
|
44
32
|
* @exampleComponent limel-example-tooltip-max-character
|
|
33
|
+
* @exampleComponent limel-example-tooltip-hotkey
|
|
34
|
+
* @exampleComponent limel-example-tooltip-accessibility
|
|
45
35
|
* @exampleComponent limel-example-tooltip-composite
|
|
46
36
|
*/
|
|
47
37
|
export declare class Tooltip {
|
|
@@ -57,10 +47,14 @@ export declare class Tooltip {
|
|
|
57
47
|
label: string;
|
|
58
48
|
/**
|
|
59
49
|
* Additional helper text for the element.
|
|
60
|
-
* Example usage can be a keyboard shortcut to activate the function of the
|
|
61
|
-
* owner element.
|
|
62
50
|
*/
|
|
63
51
|
helperLabel?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Keyboard shortcut to visualize inside the tooltip, e.g. `"ctrl+f"`.
|
|
54
|
+
* Display-only: the tooltip does not listen for the keystroke.
|
|
55
|
+
* Catching the hotkey is the consumer's responsibility.
|
|
56
|
+
*/
|
|
57
|
+
hotkey?: string;
|
|
64
58
|
/**
|
|
65
59
|
* The maximum amount of characters before rendering 'label' and
|
|
66
60
|
* 'helperLabel' in two rows.
|
|
@@ -80,7 +74,7 @@ export declare class Tooltip {
|
|
|
80
74
|
connectedCallback(): void;
|
|
81
75
|
disconnectedCallback(): void;
|
|
82
76
|
render(): JSX.Element;
|
|
83
|
-
private
|
|
77
|
+
private setOwnerAriaDescribedby;
|
|
84
78
|
private addListeners;
|
|
85
79
|
private removeListeners;
|
|
86
80
|
private showTooltip;
|
|
@@ -3844,16 +3844,6 @@ export namespace Components {
|
|
|
3844
3844
|
* Therefore, users cannot interact with the tip, but if the trigger element
|
|
3845
3845
|
* itself is interactive, it will remain interactible even with a tooltip bound
|
|
3846
3846
|
* to it.
|
|
3847
|
-
* :::note
|
|
3848
|
-
* In order to display the tooltip, the tooltip element and its trigger element
|
|
3849
|
-
* must be within the same document or document fragment (the same shadowRoot).
|
|
3850
|
-
* Often, it's easiest to just place them next to each other like in the example
|
|
3851
|
-
* below, but if you need to, you can place them differently.
|
|
3852
|
-
* ```html
|
|
3853
|
-
* <limel-button icon="search" id="tooltip-example" />
|
|
3854
|
-
* <limel-tooltip label="Search" elementId="tooltip-example" />
|
|
3855
|
-
* ```
|
|
3856
|
-
* :::
|
|
3857
3847
|
* ## Usage
|
|
3858
3848
|
* - Keep in mind that tooltips can be distracting, and can be perceived as an interruption.
|
|
3859
3849
|
* Use them only when they add significant value.
|
|
@@ -3869,6 +3859,8 @@ export namespace Components {
|
|
|
3869
3859
|
* effortlessly recognize can be hovered.
|
|
3870
3860
|
* @exampleComponent limel-example-tooltip-basic
|
|
3871
3861
|
* @exampleComponent limel-example-tooltip-max-character
|
|
3862
|
+
* @exampleComponent limel-example-tooltip-hotkey
|
|
3863
|
+
* @exampleComponent limel-example-tooltip-accessibility
|
|
3872
3864
|
* @exampleComponent limel-example-tooltip-composite
|
|
3873
3865
|
*/
|
|
3874
3866
|
interface LimelTooltip {
|
|
@@ -3877,9 +3869,13 @@ export namespace Components {
|
|
|
3877
3869
|
*/
|
|
3878
3870
|
"elementId": string;
|
|
3879
3871
|
/**
|
|
3880
|
-
* Additional helper text for the element.
|
|
3872
|
+
* Additional helper text for the element.
|
|
3881
3873
|
*/
|
|
3882
3874
|
"helperLabel"?: string;
|
|
3875
|
+
/**
|
|
3876
|
+
* 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.
|
|
3877
|
+
*/
|
|
3878
|
+
"hotkey"?: string;
|
|
3883
3879
|
/**
|
|
3884
3880
|
* Short descriptive text of the owner element.
|
|
3885
3881
|
*/
|
|
@@ -3904,6 +3900,10 @@ export namespace Components {
|
|
|
3904
3900
|
* Read more in tooltip.tsx
|
|
3905
3901
|
*/
|
|
3906
3902
|
"helperLabel"?: string;
|
|
3903
|
+
/**
|
|
3904
|
+
* Read more in tooltip.tsx
|
|
3905
|
+
*/
|
|
3906
|
+
"hotkey"?: string;
|
|
3907
3907
|
/**
|
|
3908
3908
|
* Read more in tooltip.tsx
|
|
3909
3909
|
*/
|
|
@@ -6370,16 +6370,6 @@ declare global {
|
|
|
6370
6370
|
* Therefore, users cannot interact with the tip, but if the trigger element
|
|
6371
6371
|
* itself is interactive, it will remain interactible even with a tooltip bound
|
|
6372
6372
|
* to it.
|
|
6373
|
-
* :::note
|
|
6374
|
-
* In order to display the tooltip, the tooltip element and its trigger element
|
|
6375
|
-
* must be within the same document or document fragment (the same shadowRoot).
|
|
6376
|
-
* Often, it's easiest to just place them next to each other like in the example
|
|
6377
|
-
* below, but if you need to, you can place them differently.
|
|
6378
|
-
* ```html
|
|
6379
|
-
* <limel-button icon="search" id="tooltip-example" />
|
|
6380
|
-
* <limel-tooltip label="Search" elementId="tooltip-example" />
|
|
6381
|
-
* ```
|
|
6382
|
-
* :::
|
|
6383
6373
|
* ## Usage
|
|
6384
6374
|
* - Keep in mind that tooltips can be distracting, and can be perceived as an interruption.
|
|
6385
6375
|
* Use them only when they add significant value.
|
|
@@ -6395,6 +6385,8 @@ declare global {
|
|
|
6395
6385
|
* effortlessly recognize can be hovered.
|
|
6396
6386
|
* @exampleComponent limel-example-tooltip-basic
|
|
6397
6387
|
* @exampleComponent limel-example-tooltip-max-character
|
|
6388
|
+
* @exampleComponent limel-example-tooltip-hotkey
|
|
6389
|
+
* @exampleComponent limel-example-tooltip-accessibility
|
|
6398
6390
|
* @exampleComponent limel-example-tooltip-composite
|
|
6399
6391
|
*/
|
|
6400
6392
|
interface HTMLLimelTooltipElement extends Components.LimelTooltip, HTMLStencilElement {
|
|
@@ -10579,16 +10571,6 @@ declare namespace LocalJSX {
|
|
|
10579
10571
|
* Therefore, users cannot interact with the tip, but if the trigger element
|
|
10580
10572
|
* itself is interactive, it will remain interactible even with a tooltip bound
|
|
10581
10573
|
* to it.
|
|
10582
|
-
* :::note
|
|
10583
|
-
* In order to display the tooltip, the tooltip element and its trigger element
|
|
10584
|
-
* must be within the same document or document fragment (the same shadowRoot).
|
|
10585
|
-
* Often, it's easiest to just place them next to each other like in the example
|
|
10586
|
-
* below, but if you need to, you can place them differently.
|
|
10587
|
-
* ```html
|
|
10588
|
-
* <limel-button icon="search" id="tooltip-example" />
|
|
10589
|
-
* <limel-tooltip label="Search" elementId="tooltip-example" />
|
|
10590
|
-
* ```
|
|
10591
|
-
* :::
|
|
10592
10574
|
* ## Usage
|
|
10593
10575
|
* - Keep in mind that tooltips can be distracting, and can be perceived as an interruption.
|
|
10594
10576
|
* Use them only when they add significant value.
|
|
@@ -10604,6 +10586,8 @@ declare namespace LocalJSX {
|
|
|
10604
10586
|
* effortlessly recognize can be hovered.
|
|
10605
10587
|
* @exampleComponent limel-example-tooltip-basic
|
|
10606
10588
|
* @exampleComponent limel-example-tooltip-max-character
|
|
10589
|
+
* @exampleComponent limel-example-tooltip-hotkey
|
|
10590
|
+
* @exampleComponent limel-example-tooltip-accessibility
|
|
10607
10591
|
* @exampleComponent limel-example-tooltip-composite
|
|
10608
10592
|
*/
|
|
10609
10593
|
interface LimelTooltip {
|
|
@@ -10612,9 +10596,13 @@ declare namespace LocalJSX {
|
|
|
10612
10596
|
*/
|
|
10613
10597
|
"elementId": string;
|
|
10614
10598
|
/**
|
|
10615
|
-
* Additional helper text for the element.
|
|
10599
|
+
* Additional helper text for the element.
|
|
10616
10600
|
*/
|
|
10617
10601
|
"helperLabel"?: string;
|
|
10602
|
+
/**
|
|
10603
|
+
* 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.
|
|
10604
|
+
*/
|
|
10605
|
+
"hotkey"?: string;
|
|
10618
10606
|
/**
|
|
10619
10607
|
* Short descriptive text of the owner element.
|
|
10620
10608
|
*/
|
|
@@ -10639,6 +10627,10 @@ declare namespace LocalJSX {
|
|
|
10639
10627
|
* Read more in tooltip.tsx
|
|
10640
10628
|
*/
|
|
10641
10629
|
"helperLabel"?: string;
|
|
10630
|
+
/**
|
|
10631
|
+
* Read more in tooltip.tsx
|
|
10632
|
+
*/
|
|
10633
|
+
"hotkey"?: string;
|
|
10642
10634
|
/**
|
|
10643
10635
|
* Read more in tooltip.tsx
|
|
10644
10636
|
*/
|
|
@@ -11226,6 +11218,7 @@ declare namespace LocalJSX {
|
|
|
11226
11218
|
"elementId": string;
|
|
11227
11219
|
"label": string;
|
|
11228
11220
|
"helperLabel": string;
|
|
11221
|
+
"hotkey": string;
|
|
11229
11222
|
"maxlength": number;
|
|
11230
11223
|
"openDirection": OpenDirection;
|
|
11231
11224
|
}
|
|
@@ -11233,6 +11226,7 @@ declare namespace LocalJSX {
|
|
|
11233
11226
|
"label": string;
|
|
11234
11227
|
"helperLabel": string;
|
|
11235
11228
|
"maxlength": number;
|
|
11229
|
+
"hotkey": string;
|
|
11236
11230
|
}
|
|
11237
11231
|
|
|
11238
11232
|
interface IntrinsicElements {
|
|
@@ -12635,16 +12629,6 @@ declare module "@stencil/core" {
|
|
|
12635
12629
|
* Therefore, users cannot interact with the tip, but if the trigger element
|
|
12636
12630
|
* itself is interactive, it will remain interactible even with a tooltip bound
|
|
12637
12631
|
* to it.
|
|
12638
|
-
* :::note
|
|
12639
|
-
* In order to display the tooltip, the tooltip element and its trigger element
|
|
12640
|
-
* must be within the same document or document fragment (the same shadowRoot).
|
|
12641
|
-
* Often, it's easiest to just place them next to each other like in the example
|
|
12642
|
-
* below, but if you need to, you can place them differently.
|
|
12643
|
-
* ```html
|
|
12644
|
-
* <limel-button icon="search" id="tooltip-example" />
|
|
12645
|
-
* <limel-tooltip label="Search" elementId="tooltip-example" />
|
|
12646
|
-
* ```
|
|
12647
|
-
* :::
|
|
12648
12632
|
* ## Usage
|
|
12649
12633
|
* - Keep in mind that tooltips can be distracting, and can be perceived as an interruption.
|
|
12650
12634
|
* Use them only when they add significant value.
|
|
@@ -12660,6 +12644,8 @@ declare module "@stencil/core" {
|
|
|
12660
12644
|
* effortlessly recognize can be hovered.
|
|
12661
12645
|
* @exampleComponent limel-example-tooltip-basic
|
|
12662
12646
|
* @exampleComponent limel-example-tooltip-max-character
|
|
12647
|
+
* @exampleComponent limel-example-tooltip-hotkey
|
|
12648
|
+
* @exampleComponent limel-example-tooltip-accessibility
|
|
12663
12649
|
* @exampleComponent limel-example-tooltip-composite
|
|
12664
12650
|
*/
|
|
12665
12651
|
"limel-tooltip": LocalJSX.IntrinsicElements["limel-tooltip"] & JSXBase.HTMLAttributes<HTMLLimelTooltipElement>;
|
package/package.json
CHANGED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-BjHIBY-I.js');
|
|
4
|
-
var hotkeys = require('./hotkeys-BtR8uxvl.js');
|
|
5
|
-
var device = require('./device-C9O7lYI9.js');
|
|
6
|
-
|
|
7
|
-
// Note: this function handles the same key aliases as `KEY_ALIASES` in
|
|
8
|
-
// `../../util/hotkeys.ts`, but maps them to display strings rather than
|
|
9
|
-
// canonical names. Keep both in sync when adding new aliases.
|
|
10
|
-
/**
|
|
11
|
-
* Maps a single hotkey token to its display representation.
|
|
12
|
-
*
|
|
13
|
-
* @param token - A single token from `tokenizeHotkeyString` (e.g. `"meta"`, `"k"`, `"+"`).
|
|
14
|
-
* @param isApple - Whether the current device is an Apple device.
|
|
15
|
-
* @returns The display string, whether it is a glyph (for styling),
|
|
16
|
-
* and a human-readable name for screen readers.
|
|
17
|
-
*/
|
|
18
|
-
function formatDisplayToken(token, isApple) {
|
|
19
|
-
const trimmed = (token !== null && token !== void 0 ? token : '').trim();
|
|
20
|
-
if (!trimmed) {
|
|
21
|
-
return { display: '', isGlyph: false, ariaName: '' };
|
|
22
|
-
}
|
|
23
|
-
if (trimmed === '+') {
|
|
24
|
-
return { display: '+', isGlyph: false, ariaName: 'plus' };
|
|
25
|
-
}
|
|
26
|
-
const lower = trimmed.toLowerCase();
|
|
27
|
-
switch (lower) {
|
|
28
|
-
case 'meta':
|
|
29
|
-
case 'win':
|
|
30
|
-
case 'windows': {
|
|
31
|
-
return isApple
|
|
32
|
-
? { display: '⌘', isGlyph: true, ariaName: 'Command' }
|
|
33
|
-
: { display: '⊞ Win', isGlyph: false, ariaName: 'Windows' };
|
|
34
|
-
}
|
|
35
|
-
case 'cmd':
|
|
36
|
-
case 'command': {
|
|
37
|
-
return { display: '⌘', isGlyph: true, ariaName: 'Command' };
|
|
38
|
-
}
|
|
39
|
-
case 'alt':
|
|
40
|
-
case 'option': {
|
|
41
|
-
return isApple
|
|
42
|
-
? { display: '⌥', isGlyph: true, ariaName: 'Option' }
|
|
43
|
-
: { display: 'Alt', isGlyph: false, ariaName: 'Alt' };
|
|
44
|
-
}
|
|
45
|
-
case 'shift': {
|
|
46
|
-
return { display: '⇧', isGlyph: true, ariaName: 'Shift' };
|
|
47
|
-
}
|
|
48
|
-
case 'enter':
|
|
49
|
-
case 'return': {
|
|
50
|
-
return { display: '↩', isGlyph: true, ariaName: 'Enter' };
|
|
51
|
-
}
|
|
52
|
-
case 'tab': {
|
|
53
|
-
return { display: '⇥', isGlyph: true, ariaName: 'Tab' };
|
|
54
|
-
}
|
|
55
|
-
case 'delete':
|
|
56
|
-
case 'del':
|
|
57
|
-
case 'backspace': {
|
|
58
|
-
if (isApple) {
|
|
59
|
-
return { display: '⌫', isGlyph: true, ariaName: 'Delete' };
|
|
60
|
-
}
|
|
61
|
-
return lower === 'backspace'
|
|
62
|
-
? {
|
|
63
|
-
display: 'Backspace',
|
|
64
|
-
isGlyph: false,
|
|
65
|
-
ariaName: 'Backspace',
|
|
66
|
-
}
|
|
67
|
-
: { display: 'Del', isGlyph: false, ariaName: 'Delete' };
|
|
68
|
-
}
|
|
69
|
-
case 'ctrl':
|
|
70
|
-
case 'control': {
|
|
71
|
-
return isApple
|
|
72
|
-
? { display: '⌃', isGlyph: true, ariaName: 'Control' }
|
|
73
|
-
: { display: 'Ctrl', isGlyph: false, ariaName: 'Control' };
|
|
74
|
-
}
|
|
75
|
-
case 'escape':
|
|
76
|
-
case 'esc': {
|
|
77
|
-
return { display: 'Esc', isGlyph: false, ariaName: 'Escape' };
|
|
78
|
-
}
|
|
79
|
-
case 'space':
|
|
80
|
-
case 'spacebar': {
|
|
81
|
-
return { display: '␣', isGlyph: true, ariaName: 'Space' };
|
|
82
|
-
}
|
|
83
|
-
case 'arrowup':
|
|
84
|
-
case 'up': {
|
|
85
|
-
return { display: '↑', isGlyph: true, ariaName: 'Up' };
|
|
86
|
-
}
|
|
87
|
-
case 'arrowdown':
|
|
88
|
-
case 'down': {
|
|
89
|
-
return { display: '↓', isGlyph: true, ariaName: 'Down' };
|
|
90
|
-
}
|
|
91
|
-
case 'arrowleft':
|
|
92
|
-
case 'left': {
|
|
93
|
-
return { display: '←', isGlyph: true, ariaName: 'Left' };
|
|
94
|
-
}
|
|
95
|
-
case 'arrowright':
|
|
96
|
-
case 'right': {
|
|
97
|
-
return { display: '→', isGlyph: true, ariaName: 'Right' };
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return { display: trimmed, isGlyph: false, ariaName: trimmed };
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const hotkeyCss = () => `@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)}`;
|
|
104
|
-
|
|
105
|
-
const Hotkey = class {
|
|
106
|
-
constructor(hostRef) {
|
|
107
|
-
index.registerInstance(this, hostRef);
|
|
108
|
-
/**
|
|
109
|
-
* When `true`, the hotkey is rendered in a visually disabled state.
|
|
110
|
-
*/
|
|
111
|
-
this.disabled = false;
|
|
112
|
-
}
|
|
113
|
-
componentWillLoad() {
|
|
114
|
-
this.isApple = device.isAppleDevice();
|
|
115
|
-
}
|
|
116
|
-
render() {
|
|
117
|
-
const parts = hotkeys.tokenizeHotkeyString(this.value);
|
|
118
|
-
const displayParts = parts.map((part) => formatDisplayToken(part, this.isApple));
|
|
119
|
-
const ariaLabel = displayParts
|
|
120
|
-
.map((p) => p.ariaName)
|
|
121
|
-
.filter(Boolean)
|
|
122
|
-
.join(' ');
|
|
123
|
-
return (index.h(index.Host, { key: 'ab1b9d31080740d19a4633c8c5bc92b02625c111', "aria-label": ariaLabel || undefined }, displayParts.map(({ display, isGlyph }, index$1) => (index.h("kbd", { key: `${parts[index$1]}-${index$1}`, class: isGlyph ? 'is-glyph' : undefined }, index.h("span", null, display))))));
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
Hotkey.style = hotkeyCss();
|
|
127
|
-
|
|
128
|
-
exports.limel_hotkey = Hotkey;
|