import { Atom } from '../core/atom-class' ; import { Box , BoxType } from '../core/box' ; import { Context } from '../core/context' ; import type { Style } from '../public/core' ; export class OverlapAtom extends Atom { private readonly align ? : 'left' | 'right' ; private readonly boxType : BoxType ; constructor ( command , body , options ? ) { super ( 'overlap' , { command , style : options ?. style } ) ; this . skipBoundary = true ; if ( typeof body === 'string' ) { this . body = [ new Atom ( 'mord' , { value : body } ) ] ; } else { this . body = body ; } this . align = options ?. align ?? 'left' ; this . boxType = options ?. boxType ?? 'mord' ; } render ( context ) { const inner = Atom . createBox ( context , this . body , { classes : 'inner' } ) ; if ( ! inner ) return null ; if ( this . caret ) inner . caret = this . caret ; return this . bind ( context , new Box ( [ inner , new Box ( null , { classes : 'fix' } ) ] , { classes : this . align === 'left' ? 'llap' : 'rlap' , type : this . boxType , } ) ) ; } }