UNPKG

@ryusei/light

Version:

<div align="center"> <a href="https://light.ryuseijs.com"> <img alt="RyuseiLight" src="https://light.ryuseijs.com/images/svg/logo.svg" width="70"> </a>

2 lines (1 loc) 1.27 kB
!function(n,t){if("function"==typeof define&&define.amd)define([],t);else if("undefined"!=typeof exports)t();else{t(),n.unknown={}}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(){function n(n){return null!==n&&"object"==typeof n}function t(n){return"string"==typeof n}function i(n){return void 0===n}function o(n,t){if(n)for(var i=Object.keys(n),o=0;o<i.length;o++)t(n[i[o]],i[o])}function e(n,t,i){var o="rl__figcaption";n('<figcaption class="'+o+" "+o+(i?"--bottom":"--top")+'">'),n("<span>"+t+"</span>"),n("</figcaption>")}"undefined"!=typeof window&&window.RyuseiLight&&window.RyuseiLight.compose({Caption:function(f){var u=f.event,r=f.root,c=f.options,a=r&&function(i,e){if(t(e))return i.getAttribute(e)||"";n(e)&&o(e,(function(n,t){i.setAttribute(t,String(n))}))}(r,"data-rl-caption");if(a||c.caption){var s=c.caption,p=function(t){for(var e=arguments.length,f=new Array(e>1?e-1:0),u=1;u<e;u++)f[u-1]=arguments[u];return f.forEach((function(e){n(e)&&o(e,(function(n,o){i(e[o])||(t[o]=e[o])}))})),t}({},n(s)?s:null),l=p.position,d=p.html,g=a||d||(t(s)?s:"");if(g){var y="bottom"===l;u.on("open",(function(n){n('<figure class="rl__figure">'),y||e(n,g)})),u.on("closed",(function(n){y&&e(n,g,!0),n("</figure>")}))}}}})}));