UNPKG

mmjs-core

Version:
2 lines (1 loc) 1 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../utils/format.js");function m(t){var n;return(n=t??[])==null?void 0:n.map(o=>`${o.color} ${o.offset*100}%`).join(", ")}const s={transform(t,n){return t},transformGradientCss(t){if(typeof t=="string")return t;if(!(t!=null&&t.type))return"";if(t.type==="pattern"){const{image:n,imageHeight:o,imageWidth:r,svgElement:e,svgHeight:i,svgWidth:l}=t;if(n)return`url(${n}) center/${u.normalizeNumUnit(r??0)} ${u.normalizeNumUnit(o??0)}`;if(e)return`url(${e}) center/${u.normalizeNumUnit(l??0)} ${u.normalizeNumUnit(i??0)}`}if(t.type==="linear"){const{x:n,y:o,x2:r,y2:e}=t,i=r-n,l=e-o;return`linear-gradient(${90-Math.atan2(l,i)*180/Math.PI}deg, ${m(t.colorStops)})`}if(t.type==="radial"){const{x:n,y:o,r}=t;return`radial-gradient(${r*100}% ${r*100}% at ${n*100}% ${o*100}%, ${m(t.colorStops)})`}return""},transformWrapMaxWidth(t,n){return!t&&typeof t=="number"?"auto":`${t}${n}`}};exports.transfromState=s;