UNPKG

@diplodoc/transform

Version:

A simple transformer of text in YFM (Yandex Flavored Markdown) to HTML

3 lines (2 loc) 2.3 kB
"use strict";(()=>{(()=>{var p=Object.create,s=Object.defineProperty,f=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,y=(e,t)=>function(){return t||(0,e[u(e)[0]])((t={exports:{}}).exports,t),t.exports},_=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of u(t))!m.call(e,c)&&c!==o&&s(e,c,{get:()=>t[c],enumerable:!(n=f(t,c))||n.enumerable});return e},h=(e,t,o)=>(o=e!=null?p(d(e)):{},_(t||!e||!e.__esModule?s(o,"default",{value:e,enumerable:!0}):o,e)),b=y({"node_modules/get-root-node-polyfill/index.js"(e,t){"use strict";function o(r){var a=typeof r=="object"&&!!r.composed;return a?n(this):c(this)}function n(r){var a=c(r);return i(a)?n(a.host):a}function c(r){return r.parentNode!=null?c(r.parentNode):r}function i(r){return r.nodeName==="#document-fragment"&&r.constructor.name==="ShadowRoot"}typeof t=="object"&&t.exports&&(t.exports=o)}}),g=h(b());typeof document!="undefined"&&function(e){let t=e.matches||e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector;t?e.matches=e.matchesSelector=t:e.matches=e.matchesSelector=function(n){let i=(e.getRootNode?e.getRootNode():g.default.call(e)).querySelectorAll(n),r=this;return Array.prototype.some.call(i,a=>a===r)}}(Element.prototype);var l=e=>{let t=e.composedPath();return Array.isArray(t)&&t.length>0?t[0]:e.target},v=e=>{let t=l(e);return!t||!t.matches},S=".yfm-clipboard-button";function O(e){if(!e)return Promise.resolve();if(navigator.clipboard&&typeof navigator.clipboard.writeText)return navigator.clipboard.writeText(e);let t=document.createElement("textarea");return t.setAttribute("style","position: absolute; left: 1000%"),t.textContent=e,document.body.append(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),Promise.resolve()}function P(e){if(!e)return;let t=e.getAttribute("data-animation"),o=e.getRootNode().getElementById(`visibileAnimation-${t}`);o&&o.beginElement()}typeof document!="undefined"&&document.addEventListener("click",e=>{let t=l(e);if(v(e)||!t.matches(S))return;let o=t.parentNode;if(!o)return;let n=o.querySelector("pre code");n&&O(n.innerText).then(()=>{P(o.querySelector(".yfm-clipboard-icon"))})})})();})(); //# sourceMappingURL=base.min.js.map