@diplodoc/transform 4.63.2 → 4.63.4

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.
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{(()=>{var k=Object.create,L=Object.defineProperty,j=Object.getOwnPropertyDescriptor,A=Object.getOwnPropertyNames,M=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,q=(t,e)=>function(){return e||(0,t[A(t)[0]])((e={exports:{}}).exports,e),e.exports},z=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of A(e))!F.call(t,i)&&i!==n&&L(t,i,{get:()=>e[i],enumerable:!(o=j(e,i))||o.enumerable});return t},W=(t,e,n)=>(n=t!=null?k(M(t)):{},z(e||!t||!t.__esModule?L(n,"default",{value:t,enumerable:!0}):n,t)),H=(t,e,n)=>new Promise((o,i)=>{var c=l=>{try{u(n.next(l))}catch(s){i(s)}},r=l=>{try{u(n.throw(l))}catch(s){i(s)}},u=l=>l.done?o(l.value):Promise.resolve(l.value).then(c,r);u((n=n.apply(t,e)).next())}),X=q({"node_modules/get-root-node-polyfill/index.js"(t,e){"use strict";function n(r){var u=typeof r=="object"&&!!r.composed;return u?o(this):i(this)}function o(r){var u=i(r);return c(u)?o(u.host):u}function i(r){return r.parentNode!=null?i(r.parentNode):r}function c(r){return r.nodeName==="#document-fragment"&&r.constructor.name==="ShadowRoot"}typeof e=="object"&&e.exports&&(e.exports=n)}}),Y=W(X());typeof document!="undefined"&&function(t){let e=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector;e?t.matches=t.matchesSelector=e:t.matches=t.matchesSelector=function(o){let c=(t.getRootNode?t.getRootNode():Y.default.call(t)).querySelectorAll(o),r=this;return Array.prototype.some.call(c,u=>u===r)}}(Element.prototype);var p=t=>{let e=t.composedPath();return Array.isArray(e)&&e.length>0?e[0]:t.target},b=t=>{let e=p(t);return!e||!e.matches},m=t=>H(void 0,null,function*(){if(!t)return;if(navigator.clipboard&&typeof navigator.clipboard.writeText)return navigator.clipboard.writeText(t);let e=document.createElement("textarea");e.setAttribute("style","position: absolute; left: 1000%"),e.textContent=t,document.body.append(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}),$=".yfm-clipboard-button";function K(t){if(!t)return;let e=t.getAttribute("data-animation"),n=t.getRootNode().getElementById(`visibileAnimation-${e}`);n&&n.beginElement()}function U(t){let e=t.parentNode;if(!e)return;let n=e.querySelector("pre code");if(!n)return;let o=Array.from(n.childNodes).filter(i=>!(i instanceof HTMLElement&&i.classList.contains("yfm-line-number"))).map(i=>i.textContent).join("");m(o).then(()=>{K(e.querySelector(".yfm-clipboard-icon")),setTimeout(()=>t.blur(),1500)})}typeof document!="undefined"&&document.addEventListener("click",t=>{let e=p(t),n=e.matches($);b(t)||!n||U(e)});var G=".yfm-clipboard-anchor";typeof document!="undefined"&&document.addEventListener("click",t=>{let e=p(t);if(b(t)||!e.matches(G))return;let n=e.getAttribute("data-href")||"",o=new URL(n,window.location.href).toString();m(o)});var _=".yfm-clipboard-inline-code",N="tooltip_inline_clipboard_dialog",J="yfm inline_code_tooltip",a="open",O={ru:"\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E",en:"Copied",ar:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",cs:"Zkop\xEDrov\xE1no",fr:"Copi\xE9",es:"Copiado",he:"\u05D4\u05D5\u05E2\u05EA\u05E7",bg:"\u041A\u043E\u043F\u0438\u0440\u0430\u043D\u043E",et:"Kopeeritud",el:"\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03AC\u03C6\u03B7\u03BA\u03B5",pt:"Copiado",zh:"\u5DF2\u590D\u5236","zh-tw":"\u5DF2\u8907\u88FD",kk:"\u041A\u04E9\u0448\u0456\u0440\u0456\u043B\u0434\u0456",tr:"Kopyaland\u0131",uz:"Nusxalandi"},Z={TITLE:".yfm .yfm-term_title",CONTENT:".yfm .yfm-term_dfn"},Q="open",mt=Z.CONTENT.replace(/\./g,"")+" "+Q;function h(t){let e=t.getBoundingClientRect(),n=document.body,o=document.documentElement,i=window.pageYOffset||o.scrollTop||n.scrollTop,c=window.pageXOffset||o.scrollLeft||n.scrollLeft,r=o.clientTop||n.clientTop||0,u=o.clientLeft||n.clientLeft||0,l=e.top+i-r,s=e.left+c-u;return{top:Math.round(l),left:Math.round(s)}}var d=null,y=!0;function v(){return document.getElementById(N)}function V(t,e){let n=e.getAttribute("aria-live")||"polite";t==null||t.setAttribute("aria-live",n),t==null||t.setAttribute("aria-modal","true")}function S(){d&&(clearTimeout(d),d=null)}function E(t){return t?t.closest("table")||t.closest("code")||t.parentElement:null}function w(){let t=v();if(!t)return;let e=t.getAttribute("inline-id")||"",n=document.getElementById(e);n&&T(t,n)}function T(t,e){let{x:n,y:o,right:i,left:c,width:r,height:u}=e.getBoundingClientRect(),l=E(e);if(!l)return;let{right:s,left:it}=l.getBoundingClientRect();if((s<c||it>i)&&!y){C(t);return}y&&l&&(l.addEventListener("scroll",w),y=!1);let rt=Number(t.getAttribute("relativeX")),ct=Number(t.getAttribute("relativeY"));if(rt===n&&ct===o)return;t.setAttribute("relativeX",String(n)),t.setAttribute("relativeY",String(o));let ut=u+5,f=t.parentElement;if(!f)return;let{width:g}=t.getBoundingClientRect(),{left:lt}=f.getBoundingClientRect(),R=Number(h(e).left),D=g+R,st=R-g<0,B=D>document.body.clientWidth,at=(B||document.dir==="rtl")&&!st?g-r:0,dt=h(f).top-f.offsetTop,ft=B?D-document.body.clientWidth+5:0,I=h(e).left-lt+f.offsetLeft-at,pt=I+g>=document.body.clientWidth;t.style.top=Number(h(e).top+ut-dt)+"px",t.style.left=Number(I-(pt?ft:0))+"px"}function x(t){let e=t.getAttribute("inline-id");return e?document.getElementById(e):null}function tt(t){t.classList.remove(a);let e=x(t),n=E(e),o=E(t);t.removeAttribute("inline-id"),!(!n||!o)&&(o.removeChild(t),n.removeEventListener("scroll",w),y=!0)}function et(){var t;let e=v();if(!e){let n=document.querySelector(".dc-doc-page__content")||document.body,o=document.documentElement.lang||"en",i=(t=O[o])!=null?t:O.en,c=document.createElement("div");c.innerHTML=`
1
+ "use strict";(()=>{(()=>{var k=Object.create,L=Object.defineProperty,j=Object.getOwnPropertyDescriptor,A=Object.getOwnPropertyNames,M=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty,q=(t,e)=>function(){return e||(0,t[A(t)[0]])((e={exports:{}}).exports,e),e.exports},z=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of A(e))!F.call(t,i)&&i!==n&&L(t,i,{get:()=>e[i],enumerable:!(o=j(e,i))||o.enumerable});return t},W=(t,e,n)=>(n=t!=null?k(M(t)):{},z(e||!t||!t.__esModule?L(n,"default",{value:t,enumerable:!0}):n,t)),H=(t,e,n)=>new Promise((o,i)=>{var c=l=>{try{u(n.next(l))}catch(s){i(s)}},r=l=>{try{u(n.throw(l))}catch(s){i(s)}},u=l=>l.done?o(l.value):Promise.resolve(l.value).then(c,r);u((n=n.apply(t,e)).next())}),X=q({"node_modules/get-root-node-polyfill/index.js"(t,e){"use strict";function n(r){var u=typeof r=="object"&&!!r.composed;return u?o(this):i(this)}function o(r){var u=i(r);return c(u)?o(u.host):u}function i(r){return r.parentNode!=null?i(r.parentNode):r}function c(r){return r.nodeName==="#document-fragment"&&r.constructor.name==="ShadowRoot"}typeof e=="object"&&e.exports&&(e.exports=n)}}),Y=W(X());typeof document!="undefined"&&function(t){let e=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector;e?t.matches=t.matchesSelector=e:t.matches=t.matchesSelector=function(o){let c=(t.getRootNode?t.getRootNode():Y.default.call(t)).querySelectorAll(o),r=this;return Array.prototype.some.call(c,u=>u===r)}}(Element.prototype);var p=t=>{let e=t.composedPath();return Array.isArray(e)&&e.length>0?e[0]:t.target},b=t=>{let e=p(t);return!e||!e.matches},m=t=>H(void 0,null,function*(){if(!t)return;if(navigator.clipboard&&typeof navigator.clipboard.writeText)return navigator.clipboard.writeText(t);let e=document.createElement("textarea");e.setAttribute("style","position: absolute; left: 1000%"),e.textContent=t,document.body.append(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}),$=".yfm-clipboard-button";function K(t){if(!t)return;let e=t.getAttribute("data-animation"),n=t.getRootNode().getElementById(`visibileAnimation-${e}`);n&&n.beginElement()}function U(t){let e=t.parentNode;if(!e)return;let n=e.querySelector("pre code");if(!n)return;let o=Array.from(n.childNodes).filter(i=>!(i instanceof HTMLElement&&i.classList.contains("yfm-line-number"))).map(i=>i.textContent).join("");m(o.trim()).then(()=>{K(e.querySelector(".yfm-clipboard-icon")),setTimeout(()=>t.blur(),1500)})}typeof document!="undefined"&&document.addEventListener("click",t=>{let e=p(t),n=e.matches($);b(t)||!n||U(e)});var G=".yfm-clipboard-anchor";typeof document!="undefined"&&document.addEventListener("click",t=>{let e=p(t);if(b(t)||!e.matches(G))return;let n=e.getAttribute("data-href")||"",o=new URL(n,window.location.href).toString();m(o)});var _=".yfm-clipboard-inline-code",N="tooltip_inline_clipboard_dialog",J="yfm inline_code_tooltip",a="open",O={ru:"\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E",en:"Copied",ar:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",cs:"Zkop\xEDrov\xE1no",fr:"Copi\xE9",es:"Copiado",he:"\u05D4\u05D5\u05E2\u05EA\u05E7",bg:"\u041A\u043E\u043F\u0438\u0440\u0430\u043D\u043E",et:"Kopeeritud",el:"\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03AC\u03C6\u03B7\u03BA\u03B5",pt:"Copiado",zh:"\u5DF2\u590D\u5236","zh-tw":"\u5DF2\u8907\u88FD",kk:"\u041A\u04E9\u0448\u0456\u0440\u0456\u043B\u0434\u0456",tr:"Kopyaland\u0131",uz:"Nusxalandi"},Z={TITLE:".yfm .yfm-term_title",CONTENT:".yfm .yfm-term_dfn"},Q="open",mt=Z.CONTENT.replace(/\./g,"")+" "+Q;function h(t){let e=t.getBoundingClientRect(),n=document.body,o=document.documentElement,i=window.pageYOffset||o.scrollTop||n.scrollTop,c=window.pageXOffset||o.scrollLeft||n.scrollLeft,r=o.clientTop||n.clientTop||0,u=o.clientLeft||n.clientLeft||0,l=e.top+i-r,s=e.left+c-u;return{top:Math.round(l),left:Math.round(s)}}var d=null,y=!0;function v(){return document.getElementById(N)}function V(t,e){let n=e.getAttribute("aria-live")||"polite";t==null||t.setAttribute("aria-live",n),t==null||t.setAttribute("aria-modal","true")}function S(){d&&(clearTimeout(d),d=null)}function E(t){return t?t.closest("table")||t.closest("code")||t.parentElement:null}function w(){let t=v();if(!t)return;let e=t.getAttribute("inline-id")||"",n=document.getElementById(e);n&&T(t,n)}function T(t,e){let{x:n,y:o,right:i,left:c,width:r,height:u}=e.getBoundingClientRect(),l=E(e);if(!l)return;let{right:s,left:it}=l.getBoundingClientRect();if((s<c||it>i)&&!y){C(t);return}y&&l&&(l.addEventListener("scroll",w),y=!1);let rt=Number(t.getAttribute("relativeX")),ct=Number(t.getAttribute("relativeY"));if(rt===n&&ct===o)return;t.setAttribute("relativeX",String(n)),t.setAttribute("relativeY",String(o));let ut=u+5,f=t.parentElement;if(!f)return;let{width:g}=t.getBoundingClientRect(),{left:lt}=f.getBoundingClientRect(),R=Number(h(e).left),D=g+R,st=R-g<0,B=D>document.body.clientWidth,at=(B||document.dir==="rtl")&&!st?g-r:0,dt=h(f).top-f.offsetTop,ft=B?D-document.body.clientWidth+5:0,I=h(e).left-lt+f.offsetLeft-at,pt=I+g>=document.body.clientWidth;t.style.top=Number(h(e).top+ut-dt)+"px",t.style.left=Number(I-(pt?ft:0))+"px"}function x(t){let e=t.getAttribute("inline-id");return e?document.getElementById(e):null}function tt(t){t.classList.remove(a);let e=x(t),n=E(e),o=E(t);t.removeAttribute("inline-id"),!(!n||!o)&&(o.removeChild(t),n.removeEventListener("scroll",w),y=!0)}function et(){var t;let e=v();if(!e){let n=document.querySelector(".dc-doc-page__content")||document.body,o=document.documentElement.lang||"en",i=(t=O[o])!=null?t:O.en,c=document.createElement("div");c.innerHTML=`
2
2
  <div id="${N}" class="${J}"
3
3
  role="dialog" aria-live="polite" aria-modal="true">
4
4
  ${i}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../node_modules/get-root-node-polyfill/index.js", "../../src/js/polyfill.js", "../../src/js/utils.ts", "../../src/js/code.ts", "../../src/js/anchor.ts", "../../src/js/inline-code/constant.ts", "../../src/js/term/utils.ts", "../../src/js/inline-code/utils.ts", "../../src/js/inline-code/index.ts"],
4
- "sourcesContent": ["'use strict';\n\n// Node getRootNode(optional GetRootNodeOptions options);\n\n/**\n * Returns the context object\u2019s shadow-including root if options\u2019s composed is true.\n * Returns the context object\u2019s root otherwise.\n *\n * The root of an object is itself, if its parent is null, or else it is the root of its parent.\n *\n * The shadow-including root of an object is its root\u2019s host\u2019s shadow-including root,\n * if the object\u2019s root is a shadow root, and its root otherwise.\n *\n * https://dom.spec.whatwg.org/#dom-node-getrootnode\n *\n * @memberof Node.prototype\n * @param {!Object} [opt = {}] - Options.\n * @param {!boolean} [opt.composed] - See above description.\n * @returns {!Node} The root node.\n */\nfunction getRootNode(opt) {\n var composed = typeof opt === 'object' && Boolean(opt.composed);\n\n return composed ? getShadowIncludingRoot(this) : getRoot(this);\n}\n\nfunction getShadowIncludingRoot(node) {\n var root = getRoot(node);\n\n if (isShadowRoot(root)) {\n return getShadowIncludingRoot(root.host);\n }\n\n return root;\n}\n\nfunction getRoot(node) {\n if (node.parentNode != null) {\n return getRoot(node.parentNode);\n }\n\n return node;\n}\n\nfunction isShadowRoot(node) {\n return node.nodeName === '#document-fragment' && node.constructor.name === 'ShadowRoot';\n}\n\nif (typeof module === 'object' && module.exports) {\n module.exports = getRootNode;\n}\n", "import getRootNode from 'get-root-node-polyfill';\n\nif (typeof document !== 'undefined') {\n // matches polyfill for old edge\n (function (e) {\n const matches =\n e.matches ||\n e.matchesSelector ||\n e.webkitMatchesSelector ||\n e.mozMatchesSelector ||\n e.msMatchesSelector ||\n e.oMatchesSelector;\n\n if (matches) {\n e.matches = e.matchesSelector = matches;\n } else {\n e.matches = e.matchesSelector = function matches(selector) {\n const rootNode = e.getRootNode ? e.getRootNode() : getRootNode.call(e);\n const matches = rootNode.querySelectorAll(selector);\n const th = this;\n return Array.prototype.some.call(matches, (e) => {\n return e === th;\n });\n };\n }\n // eslint-disable-next-line no-undef\n })(Element.prototype);\n}\n", "export const getEventTarget = (event: Event) => {\n const path = event.composedPath();\n return Array.isArray(path) && path.length > 0 ? path[0] : event.target;\n};\n\nexport const isCustom = (event: Event) => {\n const target = getEventTarget(event);\n return !target || !(target as HTMLElement).matches;\n};\n\nexport const copyToClipboard = async (text: string) => {\n if (!text) {\n return;\n }\n\n if (navigator.clipboard && typeof navigator.clipboard.writeText) {\n return navigator.clipboard.writeText(text);\n }\n\n const textarea = document.createElement('textarea');\n textarea.setAttribute('style', 'position: absolute; left: 1000%');\n textarea.textContent = text;\n document.body.append(textarea);\n\n textarea.select();\n document.execCommand('copy');\n\n document.body.removeChild(textarea);\n};\n", "import {copyToClipboard, getEventTarget, isCustom} from './utils';\n\nconst BUTTON_SELECTOR = '.yfm-clipboard-button';\n\nfunction notifySuccess(svgButton: HTMLElement | null) {\n if (!svgButton) {\n return;\n }\n\n const id = svgButton.getAttribute('data-animation');\n\n // @ts-expect-error\n const icon = svgButton.getRootNode().getElementById(`visibileAnimation-${id}`);\n\n if (!icon) {\n return;\n }\n\n icon.beginElement();\n}\n\nfunction buttonCopyFn(target: HTMLElement) {\n const parent = target.parentNode;\n\n if (!parent) {\n return;\n }\n\n const code = parent.querySelector<HTMLElement>('pre code');\n\n if (!code) {\n return;\n }\n\n // Get all text nodes and filter out line numbers\n const textContent = Array.from(code.childNodes)\n .filter((node) => {\n // Skip line number spans\n if (node instanceof HTMLElement && node.classList.contains('yfm-line-number')) {\n return false;\n }\n return true;\n })\n .map((node) => node.textContent)\n .join('');\n\n copyToClipboard(textContent).then(() => {\n notifySuccess(parent.querySelector('.yfm-clipboard-icon'));\n\n setTimeout(() => target.blur(), 1500);\n });\n}\n\nif (typeof document !== 'undefined') {\n document.addEventListener('click', (event) => {\n const target = getEventTarget(event) as HTMLElement;\n\n const button = target.matches(BUTTON_SELECTOR);\n\n if (isCustom(event) || !button) {\n return;\n }\n\n buttonCopyFn(target);\n });\n}\n", "import {copyToClipboard, getEventTarget, isCustom} from './utils';\n\nconst ANCHOR_BUTTON_SELECTOR = '.yfm-clipboard-anchor';\n\nif (typeof document !== 'undefined') {\n document.addEventListener('click', (event) => {\n const target = getEventTarget(event) as HTMLElement;\n\n if (isCustom(event) || !target.matches(ANCHOR_BUTTON_SELECTOR)) {\n return;\n }\n\n const href = target.getAttribute('data-href') || '';\n const link = new URL(href, window.location.href).toString();\n\n copyToClipboard(link);\n });\n}\n", "import type {Lang} from 'src/transform/typings';\n\nexport const INLINE_CODE = '.yfm-clipboard-inline-code';\n\nexport const INLINE_CODE_ID = 'tooltip_inline_clipboard_dialog';\n\nexport const INLINE_CODE_CLASS = 'yfm inline_code_tooltip';\n\nexport const OPEN_CLASS = 'open';\n\nexport const LANG_TOKEN: Record<Lang, string> = {\n ru: '\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E',\n en: 'Copied',\n ar: '\u062A\u0645 \u0627\u0644\u0646\u0633\u062E',\n cs: 'Zkop\u00EDrov\u00E1no',\n fr: 'Copi\u00E9',\n es: 'Copiado',\n he: '\u05D4\u05D5\u05E2\u05EA\u05E7',\n bg: '\u041A\u043E\u043F\u0438\u0440\u0430\u043D\u043E',\n et: 'Kopeeritud',\n el: '\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03AC\u03C6\u03B7\u03BA\u03B5',\n pt: 'Copiado',\n zh: '\u5DF2\u590D\u5236',\n 'zh-tw': '\u5DF2\u8907\u88FD',\n kk: '\u041A\u04E9\u0448\u0456\u0440\u0456\u043B\u0434\u0456',\n tr: 'Kopyaland\u0131',\n uz: 'Nusxalandi',\n};\n", "export const Selector = {\n TITLE: '.yfm .yfm-term_title',\n CONTENT: '.yfm .yfm-term_dfn',\n};\nexport const openClass = 'open';\nexport const openDefinitionClass = Selector.CONTENT.replace(/\\./g, '') + ' ' + openClass;\nlet isListenerNeeded = true;\n\nexport function setDefinitionId(definitionElement: HTMLElement, termElement: HTMLElement): void {\n const termId = termElement.getAttribute('id') || Math.random().toString(36).substr(2, 8);\n definitionElement?.setAttribute('term-id', termId);\n}\n\nexport function setDefinitonAriaAttributes(\n definitionElement: HTMLElement,\n termElement: HTMLElement,\n): void {\n const ariaLive = termElement.getAttribute('aria-live') || 'polite';\n definitionElement?.setAttribute('aria-live', ariaLive);\n definitionElement?.setAttribute('aria-modal', 'true');\n}\n\nexport function setDefinitionPosition(\n definitionElement: HTMLElement,\n termElement: HTMLElement,\n): void {\n const {\n x: termX,\n y: termY,\n right: termRight,\n left: termLeft,\n width: termWidth,\n height: termHeight,\n } = termElement.getBoundingClientRect();\n\n const termParent = termParentElement(termElement);\n\n if (!termParent) {\n return;\n }\n\n const {right: termParentRight, left: termParentLeft} = termParent.getBoundingClientRect();\n\n if ((termParentRight < termLeft || termParentLeft > termRight) && !isListenerNeeded) {\n closeDefinition(definitionElement);\n return;\n }\n\n if (isListenerNeeded && termParent) {\n termParent.addEventListener('scroll', termOnResize);\n isListenerNeeded = false;\n }\n\n const relativeX = Number(definitionElement.getAttribute('relativeX'));\n const relativeY = Number(definitionElement.getAttribute('relativeY'));\n\n if (relativeX === termX && relativeY === termY) {\n return;\n }\n\n definitionElement.setAttribute('relativeX', String(termX));\n definitionElement.setAttribute('relativeY', String(termY));\n\n const offsetTop = termHeight + 5;\n const definitionParent = definitionElement.parentElement;\n\n if (!definitionParent) {\n return;\n }\n\n const {width: definitionWidth} = definitionElement.getBoundingClientRect();\n const {left: definitionParentLeft} = definitionParent.getBoundingClientRect();\n\n // If definition not fit document change base alignment\n const definitionLeftCoordinate = Number(getCoords(termElement).left);\n const definitionRightCoordinate = definitionWidth + definitionLeftCoordinate;\n\n const definitionOutOfScreenOnLeft = definitionLeftCoordinate - definitionWidth < 0;\n const definitionOutOfScreenOnRight = definitionRightCoordinate > document.body.clientWidth;\n\n const isAlignSwapped = definitionOutOfScreenOnRight || document.dir === 'rtl';\n const fitDefinitionDocument =\n isAlignSwapped && !definitionOutOfScreenOnLeft ? definitionWidth - termWidth : 0;\n const customHeaderTop = getCoords(definitionParent).top - definitionParent.offsetTop;\n const offsetRight = 5;\n const shiftLeft = definitionOutOfScreenOnRight\n ? definitionRightCoordinate - document.body.clientWidth + offsetRight\n : 0;\n const offsetLeft =\n getCoords(termElement).left -\n definitionParentLeft +\n definitionParent.offsetLeft -\n fitDefinitionDocument;\n\n const isShiftLeftNeeded = offsetLeft + definitionWidth >= document.body.clientWidth;\n\n definitionElement.style.top =\n Number(getCoords(termElement).top + offsetTop - customHeaderTop) + 'px';\n definitionElement.style.left = Number(offsetLeft - (isShiftLeftNeeded ? shiftLeft : 0)) + 'px';\n}\n\nfunction termOnResize() {\n const openedDefinition = document.getElementsByClassName(openDefinitionClass)[0] as HTMLElement;\n\n if (!openedDefinition) {\n return;\n }\n const termId = openedDefinition.getAttribute('term-id') || '';\n const termElement = document.getElementById(termId);\n\n if (!termElement) {\n return;\n }\n\n setDefinitionPosition(openedDefinition, termElement);\n}\n\nfunction termParentElement(term: HTMLElement | null) {\n if (!term) {\n return null;\n }\n\n const closestScrollableParent = term.closest('table') || term.closest('code');\n\n return closestScrollableParent || term.parentElement;\n}\n\nexport function openDefinition(target: HTMLElement) {\n const openedDefinition = document.getElementsByClassName(openDefinitionClass)[0] as HTMLElement;\n\n const termId = target.getAttribute('id');\n const termKey = target.getAttribute('term-key');\n const definitionElement = document.getElementById(termKey + '_element');\n\n const isSameTerm = openedDefinition && termId === openedDefinition.getAttribute('term-id');\n if (isSameTerm) {\n closeDefinition(openedDefinition);\n return;\n }\n\n const isTargetDefinitionContent = target.closest(\n [Selector.CONTENT.replace(' ', ''), openClass].join('.'),\n );\n\n if (openedDefinition && !isTargetDefinitionContent) {\n closeDefinition(openedDefinition);\n }\n\n if (!target.matches(Selector.TITLE) || !definitionElement) {\n return;\n }\n\n setDefinitionId(definitionElement, target);\n setDefinitonAriaAttributes(definitionElement, target);\n setDefinitionPosition(definitionElement, target);\n\n definitionElement.classList.toggle(openClass);\n\n trapFocus(definitionElement);\n}\n\nexport function closeDefinition(definition: HTMLElement) {\n definition.classList.remove(openClass);\n const term = getTermByDefinition(definition);\n const termParent = termParentElement(term);\n\n if (!termParent) {\n return;\n }\n\n termParent.removeEventListener('scroll', termOnResize);\n isListenerNeeded = true;\n}\n\nexport function getCoords(elem: HTMLElement) {\n const box = elem.getBoundingClientRect();\n\n const body = document.body;\n const docEl = document.documentElement;\n\n const scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop;\n const scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft;\n\n const clientTop = docEl.clientTop || body.clientTop || 0;\n const clientLeft = docEl.clientLeft || body.clientLeft || 0;\n\n const top = box.top + scrollTop - clientTop;\n const left = box.left + scrollLeft - clientLeft;\n\n return {top: Math.round(top), left: Math.round(left)};\n}\n\nexport function trapFocus(element: HTMLElement) {\n const focusableElements = element.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n const firstFocusableElement = focusableElements[0] as HTMLElement;\n const lastFocusableElement = focusableElements[focusableElements.length - 1] as HTMLElement;\n\n if (firstFocusableElement) {\n firstFocusableElement.focus();\n }\n\n element.addEventListener('keydown', function (e) {\n const isTabPressed = e.key === 'Tab' || e.keyCode === 9;\n if (!isTabPressed) {\n return;\n }\n\n if (e.shiftKey) {\n if (document.activeElement === firstFocusableElement) {\n lastFocusableElement.focus();\n e.preventDefault();\n }\n } else if (document.activeElement === lastFocusableElement) {\n firstFocusableElement.focus();\n e.preventDefault();\n }\n });\n}\n\nexport function getTermByDefinition(definition: HTMLElement) {\n const termId = definition.getAttribute('term-id');\n\n return termId ? document.getElementById(termId) : null;\n}\n", "import type {Lang} from 'src/transform/typings';\n\nimport {getCoords} from '../term/utils';\n\nimport {INLINE_CODE, INLINE_CODE_CLASS, INLINE_CODE_ID, LANG_TOKEN, OPEN_CLASS} from './constant';\n\nexport let timer: ReturnType<typeof setTimeout> | null = null;\n\nlet isListenerNeeded = true;\n\nexport function getTooltipElement(): HTMLElement | null {\n return document.getElementById(INLINE_CODE_ID);\n}\n\nfunction setTooltipAriaAttributes(tooltipElement: HTMLElement, targetElement: HTMLElement): void {\n const ariaLive = targetElement.getAttribute('aria-live') || 'polite';\n tooltipElement?.setAttribute('aria-live', ariaLive);\n tooltipElement?.setAttribute('aria-modal', 'true');\n}\n\nfunction checkTimerAndClear() {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n}\n\nfunction tooltipParentElement(target: HTMLElement | null) {\n if (!target) {\n return null;\n }\n\n const closestScrollableParent = target.closest('table') || target.closest('code');\n\n return closestScrollableParent || target.parentElement;\n}\n\nfunction tooltipOnResize() {\n const openedDefinition = getTooltipElement();\n\n if (!openedDefinition) {\n return;\n }\n const inlineId = openedDefinition.getAttribute('inline-id') || '';\n const targetElement = document.getElementById(inlineId);\n\n if (!targetElement) {\n return;\n }\n\n setTooltipPosition(openedDefinition, targetElement);\n}\n\nexport function setTooltipPosition(tooltipElement: HTMLElement, targetElement: HTMLElement): void {\n const {\n x: inlineX,\n y: inlineY,\n right: inlineRight,\n left: inlineLeft,\n width: inlineWidth,\n height: inlineHeight,\n } = targetElement.getBoundingClientRect();\n\n const tooltipParent = tooltipParentElement(targetElement);\n\n if (!tooltipParent) {\n return;\n }\n\n const {right: tooltipParentRight, left: tooltipParentLeft} =\n tooltipParent.getBoundingClientRect();\n\n if ((tooltipParentRight < inlineLeft || tooltipParentLeft > inlineRight) && !isListenerNeeded) {\n closeTooltip(tooltipElement);\n return;\n }\n\n if (isListenerNeeded && tooltipParent) {\n tooltipParent.addEventListener('scroll', tooltipOnResize);\n isListenerNeeded = false;\n }\n\n const relativeX = Number(tooltipElement.getAttribute('relativeX'));\n const relativeY = Number(tooltipElement.getAttribute('relativeY'));\n\n if (relativeX === inlineX && relativeY === inlineY) {\n return;\n }\n\n tooltipElement.setAttribute('relativeX', String(inlineX));\n tooltipElement.setAttribute('relativeY', String(inlineY));\n\n const offsetTop = inlineHeight + 5;\n const definitionParent = tooltipElement.parentElement;\n\n if (!definitionParent) {\n return;\n }\n\n const {width: definitionWidth} = tooltipElement.getBoundingClientRect();\n const {left: definitionParentLeft} = definitionParent.getBoundingClientRect();\n\n // If definition not fit document change base alignment\n const definitionLeftCoordinate = Number(getCoords(targetElement).left);\n const definitionRightCoordinate = definitionWidth + definitionLeftCoordinate;\n\n const definitionOutOfScreenOnLeft = definitionLeftCoordinate - definitionWidth < 0;\n const definitionOutOfScreenOnRight = definitionRightCoordinate > document.body.clientWidth;\n\n const isAlignSwapped = definitionOutOfScreenOnRight || document.dir === 'rtl';\n const fitDefinitionDocument =\n isAlignSwapped && !definitionOutOfScreenOnLeft ? definitionWidth - inlineWidth : 0;\n const customHeaderTop = getCoords(definitionParent).top - definitionParent.offsetTop;\n const offsetRight = 5;\n const shiftLeft = definitionOutOfScreenOnRight\n ? definitionRightCoordinate - document.body.clientWidth + offsetRight\n : 0;\n const offsetLeft =\n getCoords(targetElement).left -\n definitionParentLeft +\n definitionParent.offsetLeft -\n fitDefinitionDocument;\n\n const isShiftLeftNeeded = offsetLeft + definitionWidth >= document.body.clientWidth;\n\n tooltipElement.style.top =\n Number(getCoords(targetElement).top + offsetTop - customHeaderTop) + 'px';\n tooltipElement.style.left = Number(offsetLeft - (isShiftLeftNeeded ? shiftLeft : 0)) + 'px';\n}\n\nexport function getInlineCodeByTooltip(definition: HTMLElement) {\n const inlineId = definition.getAttribute('inline-id');\n\n return inlineId ? document.getElementById(inlineId) : null;\n}\n\nfunction closeTooltipFn(definition: HTMLElement) {\n definition.classList.remove(OPEN_CLASS);\n const inline = getInlineCodeByTooltip(definition);\n const inlineCodepParent = tooltipParentElement(inline);\n const tooltipParent = tooltipParentElement(definition);\n\n definition.removeAttribute('inline-id');\n\n if (!inlineCodepParent || !tooltipParent) {\n return;\n }\n\n tooltipParent.removeChild(definition);\n inlineCodepParent.removeEventListener('scroll', tooltipOnResize);\n isListenerNeeded = true;\n}\n\nfunction createTooltip() {\n let tooltip = getTooltipElement();\n\n if (!tooltip) {\n const pageContent = document.querySelector('.dc-doc-page__content') || document.body;\n const lang = document.documentElement.lang || 'en';\n const tooltipText = LANG_TOKEN[lang as Lang] ?? LANG_TOKEN.en;\n const host = document.createElement('div');\n\n host.innerHTML = `\n <div id=\"${INLINE_CODE_ID}\" class=\"${INLINE_CODE_CLASS}\"\n role=\"dialog\" aria-live=\"polite\" aria-modal=\"true\">\n ${tooltipText}\n </div>\n `;\n\n tooltip = host.firstElementChild as HTMLElement;\n pageContent.appendChild(tooltip);\n }\n\n return tooltip;\n}\n\nexport function openTooltip(target: HTMLElement) {\n const tooltip = createTooltip();\n\n if (!target.matches(INLINE_CODE) || !tooltip) {\n return;\n }\n\n tooltip.setAttribute('inline-id', target.getAttribute('id') || '');\n setTooltipAriaAttributes(tooltip, target);\n setTooltipPosition(tooltip, target);\n\n // In order not to get rid of the smooth appearance effect, I had to do this\n if (tooltip.classList.contains(OPEN_CLASS)) {\n tooltip.classList.remove(OPEN_CLASS);\n requestAnimationFrame(() => {\n tooltip.classList.add(OPEN_CLASS);\n });\n } else {\n tooltip.classList.add(OPEN_CLASS);\n }\n\n return tooltip;\n}\n\nexport function closeTooltip(target: HTMLElement) {\n checkTimerAndClear();\n closeTooltipFn(target);\n}\n\nexport function tooltipWorker(target: HTMLElement) {\n const definition = openTooltip(target);\n\n if (!definition) {\n return;\n }\n checkTimerAndClear();\n timer = setTimeout(() => {\n closeTooltip(definition);\n timer = null;\n }, 1000);\n}\n", "import {copyToClipboard, getEventTarget, isCustom} from '../utils';\n\nimport {INLINE_CODE, OPEN_CLASS} from './constant';\nimport {\n closeTooltip,\n getInlineCodeByTooltip,\n getTooltipElement,\n setTooltipPosition,\n tooltipWorker,\n} from './utils';\n\nexport function inlineCopyFn(target: HTMLElement) {\n const innerText = target.innerText;\n\n if (!innerText) {\n return;\n }\n\n copyToClipboard(innerText).then(() => {\n tooltipWorker(target);\n });\n}\n\nif (typeof document !== 'undefined') {\n document.addEventListener('click', (event) => {\n const target = getEventTarget(event) as HTMLElement;\n\n const inline = target.matches(INLINE_CODE);\n\n if (isCustom(event) || !inline) {\n return;\n }\n\n inlineCopyFn(target);\n });\n\n document.addEventListener('keydown', (event) => {\n if (event.key === 'Enter' && document.activeElement) {\n const activeElement = document.activeElement as HTMLElement;\n const classInlineCode = INLINE_CODE.replace('.', '');\n\n if (!activeElement.classList.contains(classInlineCode)) {\n return;\n }\n\n const innerText = activeElement.innerText;\n\n if (!innerText) {\n return;\n }\n\n copyToClipboard(innerText).then(() => {\n tooltipWorker(activeElement);\n });\n }\n\n const inlineTooltip = getTooltipElement();\n\n if (event.key === 'Escape' && inlineTooltip) {\n closeTooltip(inlineTooltip);\n getInlineCodeByTooltip(inlineTooltip)?.focus(); // Set focus back to open button after closing popup\n }\n });\n\n window.addEventListener('resize', () => {\n const inlineTooltip = getTooltipElement();\n if (!inlineTooltip) {\n return;\n }\n\n const inlineId = inlineTooltip.getAttribute('inline-id') || '';\n const inlineCodeElement = document.getElementById(inlineId);\n\n if (!inlineCodeElement) {\n inlineTooltip.classList.toggle(OPEN_CLASS);\n return;\n }\n\n setTooltipPosition(inlineTooltip, inlineCodeElement);\n });\n}\n"],
5
- "mappings": "yuBAAAA,EAAAC,EAAA,CAAA,+CAAAC,EAAAC,EAAA,CAAA,aAoBA,SAASC,EAAYC,EAAK,CACxB,IAAIC,EAAW,OAAOD,GAAQ,UAAY,EAAQA,EAAI,SAEtD,OAAOC,EAAWC,EAAuB,IAA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E7BiF,EAAS9E,EAAO,QAAQkB,CAAW,EAErCnB,EAASF,CAAK,GAAK,CAACiF,GAIxBW,GAAazF,CAAM,CACvB,CAAC,EAED,SAAS,iBAAiB,UAAYH,GAAU,CApCpD,IAAAoF,EAqCQ,GAAIpF,EAAM,MAAQ,SAAW,SAAS,cAAe,CACjD,IAAM8F,EAAgB,SAAS,cACzBC,EAAkB1E,EAAY,QAAQ,IAAK,EAAE,EAEnD,GAAI,CAACyE,EAAc,UAAU,SAASC,CAAe,EACjD,OAGJ,IAAMF,EAAYC,EAAc,UAEhC,GAAI,CAACD,EACD,OAGJzF,EAAgByF,CAAS,EAAE,KAAK,IAAM,CAClCF,EAAcG,CAAa,CAC/B,CAAC,CACL,CAEA,IAAME,EAAgBtD,EAAkB,EAEpC1C,EAAM,MAAQ,UAAYgG,IAC1BlC,EAAakC,CAAa,GAC1BZ,EAAAN,EAAuBkB,CAAa,IAApC,MAAAZ,EAAuC,MAAA,EAE/C,CAAC,EAED,OAAO,iBAAiB,SAAU,IAAM,CACpC,IAAMY,EAAgBtD,EAAkB,EACxC,GAAI,CAACsD,EACD,OAGJ,IAAM7C,EAAW6C,EAAc,aAAa,WAAW,GAAK,GACtDC,EAAoB,SAAS,eAAe9C,CAAQ,EAE1D,GAAI,CAAC8C,EAAmB,CACpBD,EAAc,UAAU,OAAOxE,CAAU,EACzC,MACJ,CAEA4B,EAAmB4C,EAAeC,CAAiB,CACvD,CAAC",
4
+ "sourcesContent": ["'use strict';\n\n// Node getRootNode(optional GetRootNodeOptions options);\n\n/**\n * Returns the context object\u2019s shadow-including root if options\u2019s composed is true.\n * Returns the context object\u2019s root otherwise.\n *\n * The root of an object is itself, if its parent is null, or else it is the root of its parent.\n *\n * The shadow-including root of an object is its root\u2019s host\u2019s shadow-including root,\n * if the object\u2019s root is a shadow root, and its root otherwise.\n *\n * https://dom.spec.whatwg.org/#dom-node-getrootnode\n *\n * @memberof Node.prototype\n * @param {!Object} [opt = {}] - Options.\n * @param {!boolean} [opt.composed] - See above description.\n * @returns {!Node} The root node.\n */\nfunction getRootNode(opt) {\n var composed = typeof opt === 'object' && Boolean(opt.composed);\n\n return composed ? getShadowIncludingRoot(this) : getRoot(this);\n}\n\nfunction getShadowIncludingRoot(node) {\n var root = getRoot(node);\n\n if (isShadowRoot(root)) {\n return getShadowIncludingRoot(root.host);\n }\n\n return root;\n}\n\nfunction getRoot(node) {\n if (node.parentNode != null) {\n return getRoot(node.parentNode);\n }\n\n return node;\n}\n\nfunction isShadowRoot(node) {\n return node.nodeName === '#document-fragment' && node.constructor.name === 'ShadowRoot';\n}\n\nif (typeof module === 'object' && module.exports) {\n module.exports = getRootNode;\n}\n", "import getRootNode from 'get-root-node-polyfill';\n\nif (typeof document !== 'undefined') {\n // matches polyfill for old edge\n (function (e) {\n const matches =\n e.matches ||\n e.matchesSelector ||\n e.webkitMatchesSelector ||\n e.mozMatchesSelector ||\n e.msMatchesSelector ||\n e.oMatchesSelector;\n\n if (matches) {\n e.matches = e.matchesSelector = matches;\n } else {\n e.matches = e.matchesSelector = function matches(selector) {\n const rootNode = e.getRootNode ? e.getRootNode() : getRootNode.call(e);\n const matches = rootNode.querySelectorAll(selector);\n const th = this;\n return Array.prototype.some.call(matches, (e) => {\n return e === th;\n });\n };\n }\n // eslint-disable-next-line no-undef\n })(Element.prototype);\n}\n", "export const getEventTarget = (event: Event) => {\n const path = event.composedPath();\n return Array.isArray(path) && path.length > 0 ? path[0] : event.target;\n};\n\nexport const isCustom = (event: Event) => {\n const target = getEventTarget(event);\n return !target || !(target as HTMLElement).matches;\n};\n\nexport const copyToClipboard = async (text: string) => {\n if (!text) {\n return;\n }\n\n if (navigator.clipboard && typeof navigator.clipboard.writeText) {\n return navigator.clipboard.writeText(text);\n }\n\n const textarea = document.createElement('textarea');\n textarea.setAttribute('style', 'position: absolute; left: 1000%');\n textarea.textContent = text;\n document.body.append(textarea);\n\n textarea.select();\n document.execCommand('copy');\n\n document.body.removeChild(textarea);\n};\n", "import {copyToClipboard, getEventTarget, isCustom} from './utils';\n\nconst BUTTON_SELECTOR = '.yfm-clipboard-button';\n\nfunction notifySuccess(svgButton: HTMLElement | null) {\n if (!svgButton) {\n return;\n }\n\n const id = svgButton.getAttribute('data-animation');\n\n // @ts-expect-error\n const icon = svgButton.getRootNode().getElementById(`visibileAnimation-${id}`);\n\n if (!icon) {\n return;\n }\n\n icon.beginElement();\n}\n\nfunction buttonCopyFn(target: HTMLElement) {\n const parent = target.parentNode;\n\n if (!parent) {\n return;\n }\n\n const code = parent.querySelector<HTMLElement>('pre code');\n\n if (!code) {\n return;\n }\n\n // Get all text nodes and filter out line numbers\n const textContent = Array.from(code.childNodes)\n .filter((node) => {\n // Skip line number spans\n if (node instanceof HTMLElement && node.classList.contains('yfm-line-number')) {\n return false;\n }\n return true;\n })\n .map((node) => node.textContent)\n .join('');\n\n copyToClipboard(textContent.trim()).then(() => {\n notifySuccess(parent.querySelector('.yfm-clipboard-icon'));\n\n setTimeout(() => target.blur(), 1500);\n });\n}\n\nif (typeof document !== 'undefined') {\n document.addEventListener('click', (event) => {\n const target = getEventTarget(event) as HTMLElement;\n\n const button = target.matches(BUTTON_SELECTOR);\n\n if (isCustom(event) || !button) {\n return;\n }\n\n buttonCopyFn(target);\n });\n}\n", "import {copyToClipboard, getEventTarget, isCustom} from './utils';\n\nconst ANCHOR_BUTTON_SELECTOR = '.yfm-clipboard-anchor';\n\nif (typeof document !== 'undefined') {\n document.addEventListener('click', (event) => {\n const target = getEventTarget(event) as HTMLElement;\n\n if (isCustom(event) || !target.matches(ANCHOR_BUTTON_SELECTOR)) {\n return;\n }\n\n const href = target.getAttribute('data-href') || '';\n const link = new URL(href, window.location.href).toString();\n\n copyToClipboard(link);\n });\n}\n", "import type {Lang} from 'src/transform/typings';\n\nexport const INLINE_CODE = '.yfm-clipboard-inline-code';\n\nexport const INLINE_CODE_ID = 'tooltip_inline_clipboard_dialog';\n\nexport const INLINE_CODE_CLASS = 'yfm inline_code_tooltip';\n\nexport const OPEN_CLASS = 'open';\n\nexport const LANG_TOKEN: Record<Lang, string> = {\n ru: '\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E',\n en: 'Copied',\n ar: '\u062A\u0645 \u0627\u0644\u0646\u0633\u062E',\n cs: 'Zkop\u00EDrov\u00E1no',\n fr: 'Copi\u00E9',\n es: 'Copiado',\n he: '\u05D4\u05D5\u05E2\u05EA\u05E7',\n bg: '\u041A\u043E\u043F\u0438\u0440\u0430\u043D\u043E',\n et: 'Kopeeritud',\n el: '\u0391\u03BD\u03C4\u03B9\u03B3\u03C1\u03AC\u03C6\u03B7\u03BA\u03B5',\n pt: 'Copiado',\n zh: '\u5DF2\u590D\u5236',\n 'zh-tw': '\u5DF2\u8907\u88FD',\n kk: '\u041A\u04E9\u0448\u0456\u0440\u0456\u043B\u0434\u0456',\n tr: 'Kopyaland\u0131',\n uz: 'Nusxalandi',\n};\n", "export const Selector = {\n TITLE: '.yfm .yfm-term_title',\n CONTENT: '.yfm .yfm-term_dfn',\n};\nexport const openClass = 'open';\nexport const openDefinitionClass = Selector.CONTENT.replace(/\\./g, '') + ' ' + openClass;\nlet isListenerNeeded = true;\n\nexport function setDefinitionId(definitionElement: HTMLElement, termElement: HTMLElement): void {\n const termId = termElement.getAttribute('id') || Math.random().toString(36).substr(2, 8);\n definitionElement?.setAttribute('term-id', termId);\n}\n\nexport function setDefinitonAriaAttributes(\n definitionElement: HTMLElement,\n termElement: HTMLElement,\n): void {\n const ariaLive = termElement.getAttribute('aria-live') || 'polite';\n definitionElement?.setAttribute('aria-live', ariaLive);\n definitionElement?.setAttribute('aria-modal', 'true');\n}\n\nexport function setDefinitionPosition(\n definitionElement: HTMLElement,\n termElement: HTMLElement,\n): void {\n const {\n x: termX,\n y: termY,\n right: termRight,\n left: termLeft,\n width: termWidth,\n height: termHeight,\n } = termElement.getBoundingClientRect();\n\n const termParent = termParentElement(termElement);\n\n if (!termParent) {\n return;\n }\n\n const {right: termParentRight, left: termParentLeft} = termParent.getBoundingClientRect();\n\n if ((termParentRight < termLeft || termParentLeft > termRight) && !isListenerNeeded) {\n closeDefinition(definitionElement);\n return;\n }\n\n if (isListenerNeeded && termParent) {\n termParent.addEventListener('scroll', termOnResize);\n isListenerNeeded = false;\n }\n\n const relativeX = Number(definitionElement.getAttribute('relativeX'));\n const relativeY = Number(definitionElement.getAttribute('relativeY'));\n\n if (relativeX === termX && relativeY === termY) {\n return;\n }\n\n definitionElement.setAttribute('relativeX', String(termX));\n definitionElement.setAttribute('relativeY', String(termY));\n\n const offsetTop = termHeight + 5;\n const definitionParent = definitionElement.parentElement;\n\n if (!definitionParent) {\n return;\n }\n\n const {width: definitionWidth} = definitionElement.getBoundingClientRect();\n const {left: definitionParentLeft} = definitionParent.getBoundingClientRect();\n\n // If definition not fit document change base alignment\n const definitionLeftCoordinate = Number(getCoords(termElement).left);\n const definitionRightCoordinate = definitionWidth + definitionLeftCoordinate;\n\n const definitionOutOfScreenOnLeft = definitionLeftCoordinate - definitionWidth < 0;\n const definitionOutOfScreenOnRight = definitionRightCoordinate > document.body.clientWidth;\n\n const isAlignSwapped = definitionOutOfScreenOnRight || document.dir === 'rtl';\n const fitDefinitionDocument =\n isAlignSwapped && !definitionOutOfScreenOnLeft ? definitionWidth - termWidth : 0;\n const customHeaderTop = getCoords(definitionParent).top - definitionParent.offsetTop;\n const offsetRight = 5;\n const shiftLeft = definitionOutOfScreenOnRight\n ? definitionRightCoordinate - document.body.clientWidth + offsetRight\n : 0;\n const offsetLeft =\n getCoords(termElement).left -\n definitionParentLeft +\n definitionParent.offsetLeft -\n fitDefinitionDocument;\n\n const isShiftLeftNeeded = offsetLeft + definitionWidth >= document.body.clientWidth;\n\n definitionElement.style.top =\n Number(getCoords(termElement).top + offsetTop - customHeaderTop) + 'px';\n definitionElement.style.left = Number(offsetLeft - (isShiftLeftNeeded ? shiftLeft : 0)) + 'px';\n}\n\nfunction termOnResize() {\n const openedDefinition = document.getElementsByClassName(openDefinitionClass)[0] as HTMLElement;\n\n if (!openedDefinition) {\n return;\n }\n const termId = openedDefinition.getAttribute('term-id') || '';\n const termElement = document.getElementById(termId);\n\n if (!termElement) {\n return;\n }\n\n setDefinitionPosition(openedDefinition, termElement);\n}\n\nfunction termParentElement(term: HTMLElement | null) {\n if (!term) {\n return null;\n }\n\n const closestScrollableParent = term.closest('table') || term.closest('code');\n\n return closestScrollableParent || term.parentElement;\n}\n\nexport function openDefinition(target: HTMLElement) {\n const openedDefinition = document.getElementsByClassName(openDefinitionClass)[0] as HTMLElement;\n\n const termId = target.getAttribute('id');\n const termKey = target.getAttribute('term-key');\n const definitionElement = document.getElementById(termKey + '_element');\n\n const isSameTerm = openedDefinition && termId === openedDefinition.getAttribute('term-id');\n if (isSameTerm) {\n closeDefinition(openedDefinition);\n return;\n }\n\n const isTargetDefinitionContent = target.closest(\n [Selector.CONTENT.replace(' ', ''), openClass].join('.'),\n );\n\n if (openedDefinition && !isTargetDefinitionContent) {\n closeDefinition(openedDefinition);\n }\n\n if (!target.matches(Selector.TITLE) || !definitionElement) {\n return;\n }\n\n setDefinitionId(definitionElement, target);\n setDefinitonAriaAttributes(definitionElement, target);\n setDefinitionPosition(definitionElement, target);\n\n definitionElement.classList.toggle(openClass);\n\n trapFocus(definitionElement);\n}\n\nexport function closeDefinition(definition: HTMLElement) {\n definition.classList.remove(openClass);\n const term = getTermByDefinition(definition);\n const termParent = termParentElement(term);\n\n if (!termParent) {\n return;\n }\n\n termParent.removeEventListener('scroll', termOnResize);\n isListenerNeeded = true;\n}\n\nexport function getCoords(elem: HTMLElement) {\n const box = elem.getBoundingClientRect();\n\n const body = document.body;\n const docEl = document.documentElement;\n\n const scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop;\n const scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft;\n\n const clientTop = docEl.clientTop || body.clientTop || 0;\n const clientLeft = docEl.clientLeft || body.clientLeft || 0;\n\n const top = box.top + scrollTop - clientTop;\n const left = box.left + scrollLeft - clientLeft;\n\n return {top: Math.round(top), left: Math.round(left)};\n}\n\nexport function trapFocus(element: HTMLElement) {\n const focusableElements = element.querySelectorAll(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n const firstFocusableElement = focusableElements[0] as HTMLElement;\n const lastFocusableElement = focusableElements[focusableElements.length - 1] as HTMLElement;\n\n if (firstFocusableElement) {\n firstFocusableElement.focus();\n }\n\n element.addEventListener('keydown', function (e) {\n const isTabPressed = e.key === 'Tab' || e.keyCode === 9;\n if (!isTabPressed) {\n return;\n }\n\n if (e.shiftKey) {\n if (document.activeElement === firstFocusableElement) {\n lastFocusableElement.focus();\n e.preventDefault();\n }\n } else if (document.activeElement === lastFocusableElement) {\n firstFocusableElement.focus();\n e.preventDefault();\n }\n });\n}\n\nexport function getTermByDefinition(definition: HTMLElement) {\n const termId = definition.getAttribute('term-id');\n\n return termId ? document.getElementById(termId) : null;\n}\n", "import type {Lang} from 'src/transform/typings';\n\nimport {getCoords} from '../term/utils';\n\nimport {INLINE_CODE, INLINE_CODE_CLASS, INLINE_CODE_ID, LANG_TOKEN, OPEN_CLASS} from './constant';\n\nexport let timer: ReturnType<typeof setTimeout> | null = null;\n\nlet isListenerNeeded = true;\n\nexport function getTooltipElement(): HTMLElement | null {\n return document.getElementById(INLINE_CODE_ID);\n}\n\nfunction setTooltipAriaAttributes(tooltipElement: HTMLElement, targetElement: HTMLElement): void {\n const ariaLive = targetElement.getAttribute('aria-live') || 'polite';\n tooltipElement?.setAttribute('aria-live', ariaLive);\n tooltipElement?.setAttribute('aria-modal', 'true');\n}\n\nfunction checkTimerAndClear() {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n}\n\nfunction tooltipParentElement(target: HTMLElement | null) {\n if (!target) {\n return null;\n }\n\n const closestScrollableParent = target.closest('table') || target.closest('code');\n\n return closestScrollableParent || target.parentElement;\n}\n\nfunction tooltipOnResize() {\n const openedDefinition = getTooltipElement();\n\n if (!openedDefinition) {\n return;\n }\n const inlineId = openedDefinition.getAttribute('inline-id') || '';\n const targetElement = document.getElementById(inlineId);\n\n if (!targetElement) {\n return;\n }\n\n setTooltipPosition(openedDefinition, targetElement);\n}\n\nexport function setTooltipPosition(tooltipElement: HTMLElement, targetElement: HTMLElement): void {\n const {\n x: inlineX,\n y: inlineY,\n right: inlineRight,\n left: inlineLeft,\n width: inlineWidth,\n height: inlineHeight,\n } = targetElement.getBoundingClientRect();\n\n const tooltipParent = tooltipParentElement(targetElement);\n\n if (!tooltipParent) {\n return;\n }\n\n const {right: tooltipParentRight, left: tooltipParentLeft} =\n tooltipParent.getBoundingClientRect();\n\n if ((tooltipParentRight < inlineLeft || tooltipParentLeft > inlineRight) && !isListenerNeeded) {\n closeTooltip(tooltipElement);\n return;\n }\n\n if (isListenerNeeded && tooltipParent) {\n tooltipParent.addEventListener('scroll', tooltipOnResize);\n isListenerNeeded = false;\n }\n\n const relativeX = Number(tooltipElement.getAttribute('relativeX'));\n const relativeY = Number(tooltipElement.getAttribute('relativeY'));\n\n if (relativeX === inlineX && relativeY === inlineY) {\n return;\n }\n\n tooltipElement.setAttribute('relativeX', String(inlineX));\n tooltipElement.setAttribute('relativeY', String(inlineY));\n\n const offsetTop = inlineHeight + 5;\n const definitionParent = tooltipElement.parentElement;\n\n if (!definitionParent) {\n return;\n }\n\n const {width: definitionWidth} = tooltipElement.getBoundingClientRect();\n const {left: definitionParentLeft} = definitionParent.getBoundingClientRect();\n\n // If definition not fit document change base alignment\n const definitionLeftCoordinate = Number(getCoords(targetElement).left);\n const definitionRightCoordinate = definitionWidth + definitionLeftCoordinate;\n\n const definitionOutOfScreenOnLeft = definitionLeftCoordinate - definitionWidth < 0;\n const definitionOutOfScreenOnRight = definitionRightCoordinate > document.body.clientWidth;\n\n const isAlignSwapped = definitionOutOfScreenOnRight || document.dir === 'rtl';\n const fitDefinitionDocument =\n isAlignSwapped && !definitionOutOfScreenOnLeft ? definitionWidth - inlineWidth : 0;\n const customHeaderTop = getCoords(definitionParent).top - definitionParent.offsetTop;\n const offsetRight = 5;\n const shiftLeft = definitionOutOfScreenOnRight\n ? definitionRightCoordinate - document.body.clientWidth + offsetRight\n : 0;\n const offsetLeft =\n getCoords(targetElement).left -\n definitionParentLeft +\n definitionParent.offsetLeft -\n fitDefinitionDocument;\n\n const isShiftLeftNeeded = offsetLeft + definitionWidth >= document.body.clientWidth;\n\n tooltipElement.style.top =\n Number(getCoords(targetElement).top + offsetTop - customHeaderTop) + 'px';\n tooltipElement.style.left = Number(offsetLeft - (isShiftLeftNeeded ? shiftLeft : 0)) + 'px';\n}\n\nexport function getInlineCodeByTooltip(definition: HTMLElement) {\n const inlineId = definition.getAttribute('inline-id');\n\n return inlineId ? document.getElementById(inlineId) : null;\n}\n\nfunction closeTooltipFn(definition: HTMLElement) {\n definition.classList.remove(OPEN_CLASS);\n const inline = getInlineCodeByTooltip(definition);\n const inlineCodepParent = tooltipParentElement(inline);\n const tooltipParent = tooltipParentElement(definition);\n\n definition.removeAttribute('inline-id');\n\n if (!inlineCodepParent || !tooltipParent) {\n return;\n }\n\n tooltipParent.removeChild(definition);\n inlineCodepParent.removeEventListener('scroll', tooltipOnResize);\n isListenerNeeded = true;\n}\n\nfunction createTooltip() {\n let tooltip = getTooltipElement();\n\n if (!tooltip) {\n const pageContent = document.querySelector('.dc-doc-page__content') || document.body;\n const lang = document.documentElement.lang || 'en';\n const tooltipText = LANG_TOKEN[lang as Lang] ?? LANG_TOKEN.en;\n const host = document.createElement('div');\n\n host.innerHTML = `\n <div id=\"${INLINE_CODE_ID}\" class=\"${INLINE_CODE_CLASS}\"\n role=\"dialog\" aria-live=\"polite\" aria-modal=\"true\">\n ${tooltipText}\n </div>\n `;\n\n tooltip = host.firstElementChild as HTMLElement;\n pageContent.appendChild(tooltip);\n }\n\n return tooltip;\n}\n\nexport function openTooltip(target: HTMLElement) {\n const tooltip = createTooltip();\n\n if (!target.matches(INLINE_CODE) || !tooltip) {\n return;\n }\n\n tooltip.setAttribute('inline-id', target.getAttribute('id') || '');\n setTooltipAriaAttributes(tooltip, target);\n setTooltipPosition(tooltip, target);\n\n // In order not to get rid of the smooth appearance effect, I had to do this\n if (tooltip.classList.contains(OPEN_CLASS)) {\n tooltip.classList.remove(OPEN_CLASS);\n requestAnimationFrame(() => {\n tooltip.classList.add(OPEN_CLASS);\n });\n } else {\n tooltip.classList.add(OPEN_CLASS);\n }\n\n return tooltip;\n}\n\nexport function closeTooltip(target: HTMLElement) {\n checkTimerAndClear();\n closeTooltipFn(target);\n}\n\nexport function tooltipWorker(target: HTMLElement) {\n const definition = openTooltip(target);\n\n if (!definition) {\n return;\n }\n checkTimerAndClear();\n timer = setTimeout(() => {\n closeTooltip(definition);\n timer = null;\n }, 1000);\n}\n", "import {copyToClipboard, getEventTarget, isCustom} from '../utils';\n\nimport {INLINE_CODE, OPEN_CLASS} from './constant';\nimport {\n closeTooltip,\n getInlineCodeByTooltip,\n getTooltipElement,\n setTooltipPosition,\n tooltipWorker,\n} from './utils';\n\nexport function inlineCopyFn(target: HTMLElement) {\n const innerText = target.innerText;\n\n if (!innerText) {\n return;\n }\n\n copyToClipboard(innerText).then(() => {\n tooltipWorker(target);\n });\n}\n\nif (typeof document !== 'undefined') {\n document.addEventListener('click', (event) => {\n const target = getEventTarget(event) as HTMLElement;\n\n const inline = target.matches(INLINE_CODE);\n\n if (isCustom(event) || !inline) {\n return;\n }\n\n inlineCopyFn(target);\n });\n\n document.addEventListener('keydown', (event) => {\n if (event.key === 'Enter' && document.activeElement) {\n const activeElement = document.activeElement as HTMLElement;\n const classInlineCode = INLINE_CODE.replace('.', '');\n\n if (!activeElement.classList.contains(classInlineCode)) {\n return;\n }\n\n const innerText = activeElement.innerText;\n\n if (!innerText) {\n return;\n }\n\n copyToClipboard(innerText).then(() => {\n tooltipWorker(activeElement);\n });\n }\n\n const inlineTooltip = getTooltipElement();\n\n if (event.key === 'Escape' && inlineTooltip) {\n closeTooltip(inlineTooltip);\n getInlineCodeByTooltip(inlineTooltip)?.focus(); // Set focus back to open button after closing popup\n }\n });\n\n window.addEventListener('resize', () => {\n const inlineTooltip = getTooltipElement();\n if (!inlineTooltip) {\n return;\n }\n\n const inlineId = inlineTooltip.getAttribute('inline-id') || '';\n const inlineCodeElement = document.getElementById(inlineId);\n\n if (!inlineCodeElement) {\n inlineTooltip.classList.toggle(OPEN_CLASS);\n return;\n }\n\n setTooltipPosition(inlineTooltip, inlineCodeElement);\n });\n}\n"],
5
+ "mappings": "yuBAAAA,EAAAC,EAAA,CAAA,+CAAAC,EAAAC,EAAA,CAAA,aAoBA,SAASC,EAAYC,EAAK,CACxB,IAAIC,EAAW,OAAOD,GAAQ,UAAY,EAAQA,EAAI,SAEtD,OAAOC,EAAWC,EAAuB,IAAI,EAAIC,EAAQ,IAAI,CAC/D,CAEA,SAASD,EAAuBE,EAAM,CACpC,IAAIC,EAAOF,EAAQC,CAAI,EAEvB,OAAIE,EAAaD,CAAI,EACZH,EAAuBG,EAAK,IAAI,EAGlCA,CACT,CAEA,SAASF,EAAQC,EAAM,CACrB,OAAIA,EAAK,YAAc,KACdD,EAAQC,EAAK,UAAU,EAGzBA,CACT,CAEA,SAASE,EAAaF,EAAM,CAC1B,OAAOA,EAAK,WAAa,sBAAwBA,EAAK,YAAY,OAAS,YAC7E,CAEI,OAAON,GAAW,UAAYA,EAAO,UACvCA,EAAO,QAAUC,EACnB,CAAA,CAAA,EClDAQ,EAAwBC,EAAAb,EAAA,CAAA,EAEpB,OAAO,UAAa,aAEnB,SAAUc,EAAG,CACV,IAAMC,EACFD,EAAE,SACFA,EAAE,iBACFA,EAAE,uBACFA,EAAE,oBACFA,EAAE,mBACFA,EAAE,iBAEFC,EACAD,EAAE,QAAUA,EAAE,gBAAkBC,EAEhCD,EAAE,QAAUA,EAAE,gBAAkB,SAAiBE,EAAU,CAEvD,IAAMD,GADWD,EAAE,YAAcA,EAAE,YAAY,EAAIF,EAAAR,QAAY,KAAKU,CAAC,GAC5C,iBAAiBE,CAA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EAAoB,SAAS,eAAe9C,CAAQ,EAE1D,GAAI,CAAC8C,EAAmB,CACpBD,EAAc,UAAU,OAAOxE,CAAU,EACzC,MACJ,CAEA4B,EAAmB4C,EAAeC,CAAiB,CACvD,CAAC",
6
6
  "names": ["require_get_root_node_polyfill", "__commonJS", "exports", "module", "getRootNode", "opt", "composed", "getShadowIncludingRoot", "getRoot", "node", "root", "isShadowRoot", "import_get_root_node_polyfill", "__toESM", "e", "matches", "selector", "th", "getEventTarget", "event", "path", "isCustom", "target", "copyToClipboard", "text", "__async", "textarea", "BUTTON_SELECTOR", "notifySuccess", "svgButton", "id", "icon", "buttonCopyFn", "parent", "code", "textContent", "button", "ANCHOR_BUTTON_SELECTOR", "href", "link", "INLINE_CODE", "INLINE_CODE_ID", "INLINE_CODE_CLASS", "OPEN_CLASS", "LANG_TOKEN", "Selector", "openClass", "openDefinitionClass", "getCoords", "elem", "box", "body", "docEl", "scrollTop", "scrollLeft", "clientTop", "clientLeft", "top", "left", "timer", "isListenerNeeded", "getTooltipElement", "setTooltipAriaAttributes", "tooltipElement", "targetElement", "ariaLive", "checkTimerAndClear", "tooltipParentElement", "tooltipOnResize", "openedDefinition", "inlineId", "setTooltipPosition", "inlineX", "inlineY", "inlineRight", "inlineLeft", "inlineWidth", "inlineHeight", "tooltipParent", "tooltipParentRight", "tooltipParentLeft", "closeTooltip", "relativeX", "relativeY", "offsetTop", "definitionParent", "definitionWidth", "definitionParentLeft", "definitionLeftCoordinate", "definitionRightCoordinate", "definitionOutOfScreenOnLeft", "definitionOutOfScreenOnRight", "fitDefinitionDocument", "customHeaderTop", "shiftLeft", "offsetLeft", "isShiftLeftNeeded", "getInlineCodeByTooltip", "definition", "closeTooltipFn", "inline", "inlineCodepParent", "createTooltip", "_a", "tooltip", "pageContent", "lang", "tooltipText", "host", "openTooltip", "tooltipWorker", "inlineCopyFn", "innerText", "activeElement", "classInlineCode", "inlineTooltip", "inlineCodeElement"]
7
7
  }
package/dist/js/yfm.js CHANGED
@@ -495,7 +495,7 @@
495
495
  }
496
496
  return true;
497
497
  }).map((node) => node.textContent).join("");
498
- copyToClipboard(textContent).then(() => {
498
+ copyToClipboard(textContent.trim()).then(() => {
499
499
  notifySuccess(parent.querySelector(".yfm-clipboard-icon"));
500
500
  setTimeout(() => target.blur(), 1500);
501
501
  });