@diplodoc/transform 4.60.1 → 4.60.3

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.
Files changed (39) hide show
  1. package/dist/css/_yfm-only.css +6 -6
  2. package/dist/css/_yfm-only.css.map +3 -3
  3. package/dist/css/_yfm-only.min.css +1 -1
  4. package/dist/css/_yfm-only.min.css.map +3 -3
  5. package/dist/css/base.css +7 -2
  6. package/dist/css/base.css.map +3 -3
  7. package/dist/css/base.min.css +1 -1
  8. package/dist/css/base.min.css.map +3 -3
  9. package/dist/css/print.css.map +1 -1
  10. package/dist/css/yfm.css +13 -8
  11. package/dist/css/yfm.css.map +3 -3
  12. package/dist/css/yfm.min.css +1 -1
  13. package/dist/css/yfm.min.css.map +3 -3
  14. package/dist/js/base.js +5 -0
  15. package/dist/js/base.js.map +2 -2
  16. package/dist/js/base.min.js +1 -1
  17. package/dist/js/base.min.js.map +3 -3
  18. package/dist/js/yfm.js +5 -0
  19. package/dist/js/yfm.js.map +2 -2
  20. package/dist/js/yfm.min.js +1 -1
  21. package/dist/js/yfm.min.js.map +3 -3
  22. package/lib/plugins/inline-code/constant.d.ts +1 -1
  23. package/lib/plugins/inline-code/index.d.ts +1 -1
  24. package/lib/plugins/inline-code/index.js +4 -3
  25. package/lib/plugins/inline-code/index.js.map +1 -1
  26. package/package.json +2 -1
  27. package/src/js/code.ts +4 -0
  28. package/src/js/inline-code/index.ts +5 -0
  29. package/src/scss/_code.scss +5 -2
  30. package/src/scss/_common.scss +16 -10
  31. package/src/scss/_inline-code.scss +9 -9
  32. package/src/scss/_note.scss +5 -3
  33. package/src/scss/_term.scss +9 -9
  34. package/src/scss/_yfm-only.scss +5 -5
  35. package/src/scss/base.scss +4 -4
  36. package/src/scss/print.scss +8 -8
  37. package/src/scss/yfm.scss +7 -6
  38. package/src/transform/plugins/inline-code/constant.ts +1 -1
  39. package/src/transform/plugins/inline-code/index.ts +5 -2
package/dist/js/base.js CHANGED
@@ -151,6 +151,7 @@
151
151
  }).map((node) => node.textContent).join("");
152
152
  copyToClipboard(textContent).then(() => {
153
153
  notifySuccess(parent.querySelector(".yfm-clipboard-icon"));
154
+ setTimeout(() => target.blur(), 1500);
154
155
  });
155
156
  }
156
157
  if (typeof document !== "undefined") {
@@ -360,6 +361,10 @@
360
361
  var _a;
361
362
  if (event.key === "Enter" && document.activeElement) {
362
363
  const activeElement = document.activeElement;
364
+ const classInlineCode = INLINE_CODE.replace(".", "");
365
+ if (!activeElement.classList.contains(classInlineCode)) {
366
+ return;
367
+ }
363
368
  const innerText = activeElement.innerText;
364
369
  if (!innerText) {
365
370
  return;
@@ -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 // @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 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}\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", "export const INLINE_CODE = '.yfm-clipboard-inline-code';\n\nexport const OPEN_CLASS = 'open';\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 {getCoords} from '../term/utils';\n\nimport {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.querySelector('.yfm-inline-code-tooltip');\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 tooltipParent = tooltipParentElement(inline);\n\n definition.removeAttribute('inline-id');\n\n if (!tooltipParent) {\n return;\n }\n\n tooltipParent.removeEventListener('scroll', tooltipOnResize);\n isListenerNeeded = true;\n}\n\nexport function openTooltip(target: HTMLElement) {\n const tooltipElement = document.getElementById('tooltip_inline_clipboard_dialog');\n\n if (!target.matches('.yfm-clipboard-inline-code') || !tooltipElement) {\n return;\n }\n\n tooltipElement.setAttribute('inline-id', target.getAttribute('id') || '');\n setTooltipAriaAttributes(tooltipElement, target);\n setTooltipPosition(tooltipElement, target);\n\n // In order not to get rid of the smooth appearance effect, I had to do this\n if (tooltipElement.classList.contains(OPEN_CLASS)) {\n tooltipElement.classList.remove(OPEN_CLASS);\n requestAnimationFrame(() => {\n tooltipElement.classList.add(OPEN_CLASS);\n });\n } else {\n tooltipElement.classList.add(OPEN_CLASS);\n }\n\n return tooltipElement;\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\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}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,yBAAmB,eAAe,iBAAiB;AAAA,IACvD,CAAC;AAAA,EACL;",
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", "export const INLINE_CODE = '.yfm-clipboard-inline-code';\n\nexport const OPEN_CLASS = 'open';\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 {getCoords} from '../term/utils';\n\nimport {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.querySelector('.yfm-inline-code-tooltip');\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 tooltipParent = tooltipParentElement(inline);\n\n definition.removeAttribute('inline-id');\n\n if (!tooltipParent) {\n return;\n }\n\n tooltipParent.removeEventListener('scroll', tooltipOnResize);\n isListenerNeeded = true;\n}\n\nexport function openTooltip(target: HTMLElement) {\n const tooltipElement = document.getElementById('tooltip_inline_clipboard_dialog');\n\n if (!target.matches('.yfm-clipboard-inline-code') || !tooltipElement) {\n return;\n }\n\n tooltipElement.setAttribute('inline-id', target.getAttribute('id') || '');\n setTooltipAriaAttributes(tooltipElement, target);\n setTooltipPosition(tooltipElement, target);\n\n // In order not to get rid of the smooth appearance effect, I had to do this\n if (tooltipElement.classList.contains(OPEN_CLASS)) {\n tooltipElement.classList.remove(OPEN_CLASS);\n requestAnimationFrame(() => {\n tooltipElement.classList.add(OPEN_CLASS);\n });\n } else {\n tooltipElement.classList.add(OPEN_CLASS);\n }\n\n return tooltipElement;\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAoBA,eAASA,aAAY,KAAK;AACxB,YAAI,WAAW,OAAO,QAAQ,YAAY,QAAQ,IAAI,QAAQ;AAE9D,eAAO,WAAW,uBAAuB,IAAI,IAAI,QAAQ,IAAI;AAAA,MAC/D;AAEA,eAAS,uBAAuB,MAAM;AACpC,YAAI,OAAO,QAAQ,IAAI;AAEvB,YAAI,aAAa,IAAI,GAAG;AACtB,iBAAO,uBAAuB,KAAK,IAAI;AAAA,QACzC;AAEA,eAAO;AAAA,MACT;AAEA,eAAS,QAAQ,MAAM;AACrB,YAAI,KAAK,cAAc,MAAM;AAC3B,iBAAO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,QAAQ,WAAW;AAEzC,UAAI,SAAS,KAAK,KAAK,CAAC,QAAQ;AAC5B;AAAA,MACJ;AAEA,mBAAa,MAAM;AAAA,IACvB,CAAC;AAED,aAAS,iBAAiB,WAAW,CAAC,UAAU;AApCpD;AAqCQ,UAAI,MAAM,QAAQ,WAAW,SAAS,eAAe;AACjD,cAAM,gBAAgB,SAAS;AAC/B,cAAM,kBAAkB,YAAY,QAAQ,KAAK,EAAE;AAEnD,YAAI,CAAC,cAAc,UAAU,SAAS,eAAe,GAAG;AACpD;AAAA,QACJ;AAEA,cAAM,YAAY,cAAc;AAEhC,YAAI,CAAC,WAAW;AACZ;AAAA,QACJ;AAEA,wBAAgB,SAAS,EAAE,KAAK,MAAM;AAClC,wBAAc,aAAa;AAAA,QAC/B,CAAC;AAAA,MACL;AAEA,YAAM,gBAAgB,kBAAkB;AAExC,UAAI,MAAM,QAAQ,YAAY,eAAe;AACzC,qBAAa,aAAa;AAC1B,qCAAuB,aAAa,MAApC,mBAAuC;AAAA,MAC3C;AAAA,IACJ,CAAC;AAED,WAAO,iBAAiB,UAAU,MAAM;AACpC,YAAM,gBAAgB,kBAAkB;AACxC,UAAI,CAAC,eAAe;AAChB;AAAA,MACJ;AAEA,YAAM,WAAW,cAAc,aAAa,WAAW,KAAK;AAC5D,YAAM,oBAAoB,SAAS,eAAe,QAAQ;AAE1D,UAAI,CAAC,mBAAmB;AACpB,sBAAc,UAAU,OAAO,UAAU;AACzC;AAAA,MACJ;AAEA,yBAAmB,eAAe,iBAAiB;AAAA,IACvD,CAAC;AAAA,EACL;",
6
6
  "names": ["getRootNode", "matches", "getRootNode", "e"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";(()=>{(()=>{var I=Object.create,L=Object.defineProperty,B=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyNames,j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,M=(t,e)=>function(){return e||(0,t[O(t)[0]])((e={exports:{}}).exports,e),e.exports},q=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of O(e))!k.call(t,o)&&o!==n&&L(t,o,{get:()=>e[o],enumerable:!(i=B(e,o))||i.enumerable});return t},D=(t,e,n)=>(n=t!=null?I(j(t)):{},q(e||!t||!t.__esModule?L(n,"default",{value:t,enumerable:!0}):n,t)),W=(t,e,n)=>new Promise((i,o)=>{var l=s=>{try{c(n.next(s))}catch(a){o(a)}},r=s=>{try{c(n.throw(s))}catch(a){o(a)}},c=s=>s.done?i(s.value):Promise.resolve(s.value).then(l,r);c((n=n.apply(t,e)).next())}),X=M({"node_modules/get-root-node-polyfill/index.js"(t,e){"use strict";function n(r){var c=typeof r=="object"&&!!r.composed;return c?i(this):o(this)}function i(r){var c=o(r);return l(c)?i(c.host):c}function o(r){return r.parentNode!=null?o(r.parentNode):r}function l(r){return r.nodeName==="#document-fragment"&&r.constructor.name==="ShadowRoot"}typeof e=="object"&&e.exports&&(e.exports=n)}}),Y=D(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(i){let l=(t.getRootNode?t.getRootNode():Y.default.call(t)).querySelectorAll(i),r=this;return Array.prototype.some.call(l,c=>c===r)}}(Element.prototype);var p=t=>{let e=t.composedPath();return Array.isArray(e)&&e.length>0?e[0]:t.target},g=t=>{let e=p(t);return!e||!e.matches},m=t=>W(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)}),F=".yfm-clipboard-button";function H(t){if(!t)return;let e=t.getAttribute("data-animation"),n=t.getRootNode().getElementById(`visibileAnimation-${e}`);n&&n.beginElement()}function z(t){let e=t.parentNode;if(!e)return;let n=e.querySelector("pre code");if(!n)return;let i=Array.from(n.childNodes).filter(o=>!(o instanceof HTMLElement&&o.classList.contains("yfm-line-number"))).map(o=>o.textContent).join("");m(i).then(()=>{H(e.querySelector(".yfm-clipboard-icon"))})}typeof document!="undefined"&&document.addEventListener("click",t=>{let e=p(t),n=e.matches(F);g(t)||!n||z(e)});var U=".yfm-clipboard-anchor";typeof document!="undefined"&&document.addEventListener("click",t=>{let e=p(t);if(g(t)||!e.matches(U))return;let n=e.getAttribute("data-href")||"",i=new URL(n,window.location.href).toString();m(i)});var J=".yfm-clipboard-inline-code",u="open",$={TITLE:".yfm .yfm-term_title",CONTENT:".yfm .yfm-term_dfn"},G="open",ut=$.CONTENT.replace(/\./g,"")+" "+G;function y(t){let e=t.getBoundingClientRect(),n=document.body,i=document.documentElement,o=window.pageYOffset||i.scrollTop||n.scrollTop,l=window.pageXOffset||i.scrollLeft||n.scrollLeft,r=i.clientTop||n.clientTop||0,c=i.clientLeft||n.clientLeft||0,s=e.top+o-r,a=e.left+l-c;return{top:Math.round(s),left:Math.round(a)}}var f=null,h=!0;function v(){return document.querySelector(".yfm-inline-code-tooltip")}function K(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(){f&&(clearTimeout(f),f=null)}function A(t){return t?t.closest("table")||t.closest("code")||t.parentElement:null}function N(){let t=v();if(!t)return;let e=t.getAttribute("inline-id")||"",n=document.getElementById(e);n&&_(t,n)}function _(t,e){let{x:n,y:i,right:o,left:l,width:r,height:c}=e.getBoundingClientRect(),s=A(e);if(!s)return;let{right:a,left:tt}=s.getBoundingClientRect();if((a<l||tt>o)&&!h){T(t);return}h&&s&&(s.addEventListener("scroll",N),h=!1);let et=Number(t.getAttribute("relativeX")),nt=Number(t.getAttribute("relativeY"));if(et===n&&nt===i)return;t.setAttribute("relativeX",String(n)),t.setAttribute("relativeY",String(i));let ot=c+5,d=t.parentElement;if(!d)return;let{width:b}=t.getBoundingClientRect(),{left:it}=d.getBoundingClientRect(),E=Number(y(e).left),P=b+E,rt=E-b<0,R=P>document.body.clientWidth,ct=(R||document.dir==="rtl")&&!rt?b-r:0,st=y(d).top-d.offsetTop,lt=R?P-document.body.clientWidth+5:0,x=y(e).left-it+d.offsetLeft-ct,at=x+b>=document.body.clientWidth;t.style.top=Number(y(e).top+ot-st)+"px",t.style.left=Number(x-(at?lt:0))+"px"}function C(t){let e=t.getAttribute("inline-id");return e?document.getElementById(e):null}function Q(t){t.classList.remove(u);let e=C(t),n=A(e);t.removeAttribute("inline-id"),n&&(n.removeEventListener("scroll",N),h=!0)}function V(t){let e=document.getElementById("tooltip_inline_clipboard_dialog");if(!(!t.matches(".yfm-clipboard-inline-code")||!e))return e.setAttribute("inline-id",t.getAttribute("id")||""),K(e,t),_(e,t),e.classList.contains(u)?(e.classList.remove(u),requestAnimationFrame(()=>{e.classList.add(u)})):e.classList.add(u),e}function T(t){S(),Q(t)}function w(t){let e=V(t);e&&(S(),f=setTimeout(()=>{T(e),f=null},1e3))}function Z(t){let e=t.innerText;e&&m(e).then(()=>{w(t)})}typeof document!="undefined"&&(document.addEventListener("click",t=>{let e=p(t),n=e.matches(J);g(t)||!n||Z(e)}),document.addEventListener("keydown",t=>{var e;if(t.key==="Enter"&&document.activeElement){let i=document.activeElement,o=i.innerText;if(!o)return;m(o).then(()=>{w(i)})}let n=v();t.key==="Escape"&&n&&(T(n),(e=C(n))==null||e.focus())}),window.addEventListener("resize",()=>{let t=v();if(!t)return;let e=t.getAttribute("inline-id")||"",n=document.getElementById(e);if(!n){t.classList.toggle(u);return}_(t,n)}))})();})();
1
+ "use strict";(()=>{(()=>{var B=Object.create,L=Object.defineProperty,j=Object.getOwnPropertyDescriptor,O=Object.getOwnPropertyNames,k=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty,q=(t,e)=>function(){return e||(0,t[O(t)[0]])((e={exports:{}}).exports,e),e.exports},D=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of O(e))!M.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?B(k(t)):{},D(e||!t||!t.__esModule?L(n,"default",{value:t,enumerable:!0}):n,t)),X=(t,e,n)=>new Promise((o,i)=>{var l=s=>{try{c(n.next(s))}catch(a){i(a)}},r=s=>{try{c(n.throw(s))}catch(a){i(a)}},c=s=>s.done?o(s.value):Promise.resolve(s.value).then(l,r);c((n=n.apply(t,e)).next())}),Y=q({"node_modules/get-root-node-polyfill/index.js"(t,e){"use strict";function n(r){var c=typeof r=="object"&&!!r.composed;return c?o(this):i(this)}function o(r){var c=i(r);return l(c)?o(c.host):c}function i(r){return r.parentNode!=null?i(r.parentNode):r}function l(r){return r.nodeName==="#document-fragment"&&r.constructor.name==="ShadowRoot"}typeof e=="object"&&e.exports&&(e.exports=n)}}),F=W(Y());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 l=(t.getRootNode?t.getRootNode():F.default.call(t)).querySelectorAll(o),r=this;return Array.prototype.some.call(l,c=>c===r)}}(Element.prototype);var p=t=>{let e=t.composedPath();return Array.isArray(e)&&e.length>0?e[0]:t.target},g=t=>{let e=p(t);return!e||!e.matches},m=t=>X(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)}),H=".yfm-clipboard-button";function z(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(()=>{z(e.querySelector(".yfm-clipboard-icon")),setTimeout(()=>t.blur(),1500)})}typeof document!="undefined"&&document.addEventListener("click",t=>{let e=p(t),n=e.matches(H);g(t)||!n||U(e)});var J=".yfm-clipboard-anchor";typeof document!="undefined"&&document.addEventListener("click",t=>{let e=p(t);if(g(t)||!e.matches(J))return;let n=e.getAttribute("data-href")||"",o=new URL(n,window.location.href).toString();m(o)});var S=".yfm-clipboard-inline-code",u="open",$={TITLE:".yfm .yfm-term_title",CONTENT:".yfm .yfm-term_dfn"},G="open",ut=$.CONTENT.replace(/\./g,"")+" "+G;function y(t){let e=t.getBoundingClientRect(),n=document.body,o=document.documentElement,i=window.pageYOffset||o.scrollTop||n.scrollTop,l=window.pageXOffset||o.scrollLeft||n.scrollLeft,r=o.clientTop||n.clientTop||0,c=o.clientLeft||n.clientLeft||0,s=e.top+i-r,a=e.left+l-c;return{top:Math.round(s),left:Math.round(a)}}var f=null,h=!0;function v(){return document.querySelector(".yfm-inline-code-tooltip")}function K(t,e){let n=e.getAttribute("aria-live")||"polite";t==null||t.setAttribute("aria-live",n),t==null||t.setAttribute("aria-modal","true")}function A(){f&&(clearTimeout(f),f=null)}function C(t){return t?t.closest("table")||t.closest("code")||t.parentElement:null}function N(){let t=v();if(!t)return;let e=t.getAttribute("inline-id")||"",n=document.getElementById(e);n&&_(t,n)}function _(t,e){let{x:n,y:o,right:i,left:l,width:r,height:c}=e.getBoundingClientRect(),s=C(e);if(!s)return;let{right:a,left:tt}=s.getBoundingClientRect();if((a<l||tt>i)&&!h){T(t);return}h&&s&&(s.addEventListener("scroll",N),h=!1);let et=Number(t.getAttribute("relativeX")),nt=Number(t.getAttribute("relativeY"));if(et===n&&nt===o)return;t.setAttribute("relativeX",String(n)),t.setAttribute("relativeY",String(o));let ot=c+5,d=t.parentElement;if(!d)return;let{width:b}=t.getBoundingClientRect(),{left:it}=d.getBoundingClientRect(),P=Number(y(e).left),R=b+P,rt=P-b<0,x=R>document.body.clientWidth,ct=(x||document.dir==="rtl")&&!rt?b-r:0,st=y(d).top-d.offsetTop,lt=x?R-document.body.clientWidth+5:0,I=y(e).left-it+d.offsetLeft-ct,at=I+b>=document.body.clientWidth;t.style.top=Number(y(e).top+ot-st)+"px",t.style.left=Number(I-(at?lt:0))+"px"}function w(t){let e=t.getAttribute("inline-id");return e?document.getElementById(e):null}function Q(t){t.classList.remove(u);let e=w(t),n=C(e);t.removeAttribute("inline-id"),n&&(n.removeEventListener("scroll",N),h=!0)}function V(t){let e=document.getElementById("tooltip_inline_clipboard_dialog");if(!(!t.matches(".yfm-clipboard-inline-code")||!e))return e.setAttribute("inline-id",t.getAttribute("id")||""),K(e,t),_(e,t),e.classList.contains(u)?(e.classList.remove(u),requestAnimationFrame(()=>{e.classList.add(u)})):e.classList.add(u),e}function T(t){A(),Q(t)}function E(t){let e=V(t);e&&(A(),f=setTimeout(()=>{T(e),f=null},1e3))}function Z(t){let e=t.innerText;e&&m(e).then(()=>{E(t)})}typeof document!="undefined"&&(document.addEventListener("click",t=>{let e=p(t),n=e.matches(S);g(t)||!n||Z(e)}),document.addEventListener("keydown",t=>{var e;if(t.key==="Enter"&&document.activeElement){let o=document.activeElement,i=S.replace(".","");if(!o.classList.contains(i))return;let l=o.innerText;if(!l)return;m(l).then(()=>{E(o)})}let n=v();t.key==="Escape"&&n&&(T(n),(e=w(n))==null||e.focus())}),window.addEventListener("resize",()=>{let t=v();if(!t)return;let e=t.getAttribute("inline-id")||"",n=document.getElementById(e);if(!n){t.classList.toggle(u);return}_(t,n)}))})();})();
2
2
  //# sourceMappingURL=base.min.js.map
@@ -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 // @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 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}\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", "export const INLINE_CODE = '.yfm-clipboard-inline-code';\n\nexport const OPEN_CLASS = 'open';\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 {getCoords} from '../term/utils';\n\nimport {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.querySelector('.yfm-inline-code-tooltip');\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 tooltipParent = tooltipParentElement(inline);\n\n definition.removeAttribute('inline-id');\n\n if (!tooltipParent) {\n return;\n }\n\n tooltipParent.removeEventListener('scroll', tooltipOnResize);\n isListenerNeeded = true;\n}\n\nexport function openTooltip(target: HTMLElement) {\n const tooltipElement = document.getElementById('tooltip_inline_clipboard_dialog');\n\n if (!target.matches('.yfm-clipboard-inline-code') || !tooltipElement) {\n return;\n }\n\n tooltipElement.setAttribute('inline-id', target.getAttribute('id') || '');\n setTooltipAriaAttributes(tooltipElement, target);\n setTooltipPosition(tooltipElement, target);\n\n // In order not to get rid of the smooth appearance effect, I had to do this\n if (tooltipElement.classList.contains(OPEN_CLASS)) {\n tooltipElement.classList.remove(OPEN_CLASS);\n requestAnimationFrame(() => {\n tooltipElement.classList.add(OPEN_CLASS);\n });\n } else {\n tooltipElement.classList.add(OPEN_CLASS);\n }\n\n return tooltipElement;\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\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,ECl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,CAC1C,IAAMG,EAASJ,EAAeC,CAAK,EAE7B8E,EAAS3E,EAAO,QAAQkB,CAAW,EAErCnB,EAASF,CAAK,GAAK,CAAC8E,GAIxBG,EAAa9E,CAAM,CACvB,CAAC,EAED,SAAS,iBAAiB,UAAYH,GAAU,CApCpD,IAAAmF,EAqCQ,GAAInF,EAAM,MAAQ,SAAW,SAAS,cAAe,CACjD,IAAMoF,EAAgB,SAAS,cAEzBF,EAAYE,EAAc,UAEhC,GAAI,CAACF,EACD,OAGJ9E,EAAgB8E,CAAS,EAAE,KAAK,IAAM,CAClCF,EAAcI,CAAa,CAC/B,CAAC,CACL,CAEA,IAAMC,EAAgB9C,EAAkB,EAEpCvC,EAAM,MAAQ,UAAYqF,IAC1B1B,EAAa0B,CAAa,GAC1BF,EAAAR,EAAuBU,CAAa,IAApC,MAAAF,EAAuC,MAAA,EAE/C,CAAC,EAED,OAAO,iBAAiB,SAAU,IAAM,CACpC,IAAME,EAAgB9C,EAAkB,EACxC,GAAI,CAAC8C,EACD,OAGJ,IAAMrC,EAAWqC,EAAc,aAAa,WAAW,GAAK,GACtDC,EAAoB,SAAS,eAAetC,CAAQ,EAE1D,GAAI,CAACsC,EAAmB,CACpBD,EAAc,UAAU,OAAO/D,CAAU,EACzC,MACJ,CAEA2B,EAAmBoC,EAAeC,CAAiB,CACvD,CAAC",
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", "OPEN_CLASS", "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", "openTooltip", "tooltipWorker", "inlineCopyFn", "innerText", "_a", "activeElement", "inlineTooltip", "inlineCodeElement"]
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", "export const INLINE_CODE = '.yfm-clipboard-inline-code';\n\nexport const OPEN_CLASS = 'open';\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 {getCoords} from '../term/utils';\n\nimport {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.querySelector('.yfm-inline-code-tooltip');\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 tooltipParent = tooltipParentElement(inline);\n\n definition.removeAttribute('inline-id');\n\n if (!tooltipParent) {\n return;\n }\n\n tooltipParent.removeEventListener('scroll', tooltipOnResize);\n isListenerNeeded = true;\n}\n\nexport function openTooltip(target: HTMLElement) {\n const tooltipElement = document.getElementById('tooltip_inline_clipboard_dialog');\n\n if (!target.matches('.yfm-clipboard-inline-code') || !tooltipElement) {\n return;\n }\n\n tooltipElement.setAttribute('inline-id', target.getAttribute('id') || '');\n setTooltipAriaAttributes(tooltipElement, target);\n setTooltipPosition(tooltipElement, target);\n\n // In order not to get rid of the smooth appearance effect, I had to do this\n if (tooltipElement.classList.contains(OPEN_CLASS)) {\n tooltipElement.classList.remove(OPEN_CLASS);\n requestAnimationFrame(() => {\n tooltipElement.classList.add(OPEN_CLASS);\n });\n } else {\n tooltipElement.classList.add(OPEN_CLASS);\n }\n\n return tooltipElement;\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(inlineT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CAAa,GAC1BH,EAAAR,EAAuBW,CAAa,IAApC,MAAAH,EAAuC,MAAA,EAE/C,CAAC,EAED,OAAO,iBAAiB,SAAU,IAAM,CACpC,IAAMG,EAAgB/C,EAAkB,EACxC,GAAI,CAAC+C,EACD,OAGJ,IAAMtC,EAAWsC,EAAc,aAAa,WAAW,GAAK,GACtDC,EAAoB,SAAS,eAAevC,CAAQ,EAE1D,GAAI,CAACuC,EAAmB,CACpBD,EAAc,UAAU,OAAOhE,CAAU,EACzC,MACJ,CAEA2B,EAAmBqC,EAAeC,CAAiB,CACvD,CAAC",
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", "OPEN_CLASS", "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", "openTooltip", "tooltipWorker", "inlineCopyFn", "innerText", "_a", "activeElement", "classInlineCode", "inlineTooltip", "inlineCodeElement"]
7
7
  }
package/dist/js/yfm.js CHANGED
@@ -501,6 +501,7 @@
501
501
  }).map((node) => node.textContent).join("");
502
502
  copyToClipboard(textContent).then(() => {
503
503
  notifySuccess(parent.querySelector(".yfm-clipboard-icon"));
504
+ setTimeout(() => target.blur(), 1500);
504
505
  });
505
506
  }
506
507
  if (typeof document !== "undefined") {
@@ -853,6 +854,10 @@
853
854
  var _a;
854
855
  if (event.key === "Enter" && document.activeElement) {
855
856
  const activeElement = document.activeElement;
857
+ const classInlineCode = INLINE_CODE.replace(".", "");
858
+ if (!activeElement.classList.contains(classInlineCode)) {
859
+ return;
860
+ }
856
861
  const innerText = activeElement.innerText;
857
862
  if (!innerText) {
858
863
  return;